Esempio n. 1
0
 /**
  * Checks if this check is enabled for the specified player.
  *
  * @param player the player
  * @return true, if the check is enabled
  */
 public boolean isEnabled(final Player player) {
   try {
     if (!type.isEnabled(player) || player.hasPermission(type.getPermission())) return false;
   } catch (final Exception e) {
     // TODO: this should be mostly obsolete.
     LogUtil.logSevere(e);
   }
   return !NCPExemptionManager.isExempted(player, type);
 }
Esempio n. 2
0
 @Override
 public void run() {
   final MovingData data = MovingData.getData(player);
   data.morePacketsVehicleTaskId = -1;
   try {
     data.setTeleported(location);
     TeleportUtil.teleport(vehicle, player, location, debug);
   } catch (Throwable t) {
     LogUtil.logSevere(t);
   }
 }
Esempio n. 3
0
  @Override
  public void checkConsistency(final Player[] onlinePlayers) {
    // Check online player tracking consistency.
    int missing = 0;
    int changed = 0;
    int expectedSize = 0;
    for (int i = 0; i < onlinePlayers.length; i++) {
      final Player player = onlinePlayers[i];
      final String name = player.getName();
      //			if (player.isOnline()){
      expectedSize += 1 + (name.equals(name.toLowerCase()) ? 0 : 1);
      if (!this.onlinePlayers.containsKey(name)) {
        missing++;
        // TODO: Add the player [problem: messy NPC plugins?]?
      }
      if (player != this.onlinePlayers.get(name)) {
        changed++;
        // Update the reference.
        addOnlinePlayer(player);
        //				}
      }
    }

    // TODO: Consider checking lastLogout for too long gone players.

    final int storedSize = this.onlinePlayers.size();
    if (missing != 0 || changed != 0 || expectedSize != storedSize) {
      final List<String> details = new LinkedList<String>();
      if (missing != 0) {
        details.add("missing online players (" + missing + ")");
      }
      if (expectedSize != storedSize) {
        // TODO: Consider checking for not online players and remove them.
        details.add(
            "wrong number of online players (" + storedSize + " instead of " + expectedSize + ")");
      }
      if (changed != 0) {
        details.add("changed player instances (" + changed + ")");
      }

      LogUtil.logWarning(
          "[NoCheatPlus] DataMan inconsistencies: " + StringUtil.join(details, " | "));
    }
  }