Ejemplo n.º 1
0
  private String getPermissionsForPlayerAsString(Player p) {

    String s = "";

    for (Check c : checks) {
      s = s + (!c.isActive() ? c.getName() + "* " : (c.skipCheck(p) ? c.getName() + " " : ""));
    }

    s =
        s
            + (!movingCheck.isActive() || movingCheck.allowFlying
                ? "flying* "
                : (hasPermission(p, PermissionData.PERMISSION_FLYING, movingCheck.checkOPs)
                    ? "flying "
                    : ""));
    s =
        s
            + (!movingCheck.isActive() || movingCheck.allowFakeSneak
                ? "fakesneak* "
                : (hasPermission(p, PermissionData.PERMISSION_FAKESNEAK, movingCheck.checkOPs)
                    ? "fakesneak "
                    : ""));
    s =
        s
            + (!movingCheck.isActive() || movingCheck.allowFastSwim
                ? "fastswim* "
                : (hasPermission(p, PermissionData.PERMISSION_FASTSWIM, movingCheck.checkOPs)
                    ? "fastswim "
                    : ""));

    s = s + (hasPermission(p, PermissionData.PERMISSION_NOTIFY, false) ? "notify " : "");

    return s;
  }
Ejemplo n.º 2
0
  private String getActiveChecksAsString() {

    String s = "";

    for (Check c : checks) {
      s = s + (c.isActive() ? c.getName() + " " : "");
    }

    s = s + (movingCheck.isActive() && !movingCheck.allowFlying ? "flying " : "");
    s = s + (movingCheck.isActive() && !movingCheck.allowFakeSneak ? "fakesneak " : "");
    s = s + (movingCheck.isActive() && !movingCheck.allowFastSwim ? "fastswim " : "");

    return s;
  }
Ejemplo n.º 3
0
  public void onEnable() {

    dataManager = new DataManager();

    sender = new CustomCommandSender(getServer());
    // parse the nocheat.yml config file
    setupConfig();

    for (String s : getMessagesOfTheDay()) {
      if (showStartupMessages) Logger.getLogger("Minecraft").info("(NoCheat) Did you know? " + s);
    }

    movingCheck = new MovingCheck(this, config);
    speedhackCheck = new SpeedhackCheck(this, config);
    airbuildCheck = new AirbuildCheck(this, config);
    bogusitemsCheck = new BogusitemsCheck(this, config);
    nukeCheck = new NukeCheck(this, config);

    // just for convenience
    checks = new Check[] {movingCheck, speedhackCheck, airbuildCheck, bogusitemsCheck, nukeCheck};

    if (!this.getServer().getAllowFlight() && movingCheck.isActive()) {
      Logger.getLogger("Minecraft")
          .warning(
              "[NoCheat] you have set \"allow-flight=false\" in your server.properties file. That builtin anti-flying-mechanism will likely conflict with this plugin. Please consider deactivating it by setting it to \"true\"");
    }

    PluginDescriptionFile pdfFile = this.getDescription();

    // Get, if available, the Permissions and irc plugin
    if (!useNewPermissionSystem) {
      setupPermissions();
    }
    setupIRC();

    Logger.getLogger("Minecraft")
        .info(
            "[NoCheat] version ["
                + pdfFile.getVersion()
                + "] is enabled with the following checks: "
                + getActiveChecksAsString());

    setupCleanupTask();

    setupServerLagMeasureTask();
  }