예제 #1
0
  @Override
  public void onLoad() {
    instance = this;
    log(
        "ThisIsAreku present "
            + this.getDescription().getName().toUpperCase()
            + ", v"
            + getDescription().getVersion());
    log("= " + this.getDescription().getWebsite() + " =");
    this.masterFilter = new MasterFilter();

    ColorConverter.initColorConverter();
    Config.loadConfig();
    loadFilters();
    initializeMasterFilter();

    if (Config.force_filters) {
      Bukkit.getServer()
          .getScheduler()
          .scheduleSyncRepeatingTask(
              this,
              new Runnable() {

                @Override
                public void run() {
                  initializeMasterFilter();
                }
              },
              5,
              Config.force_filters_intv * 20);
    }
  }
예제 #2
0
  @Override
  public boolean onCommand(CommandSender cs, Command command, String label, String[] args) {

    if (!cs.isOp()) {
      sendMessage(cs, ChatColor.RED + "You must be an OP to reload filters");
      return true;
    }
    if ((args.length == 0) || (args.length == 1 && "help".equals(args[0]))) {
      sendMessage(cs, ChatColor.YELLOW + "Usage: /tlmd reload");
      return true;
    }

    if ("reload".equals(args[0])) {
      initializeMasterFilter();
      loadFilters();
      sendMessage(cs, ChatColor.GREEN + (this.masterFilter.filterCount() + " filter(s) loaded"));
      return true;
    }
    return super.onCommand(cs, command, label, args);
  }