Exemplo n.º 1
0
  /**
   * Loads the config from file and validates the data
   *
   * @param plugin
   */
  public Config(HawkEye plugin) {

    config = plugin.getConfig().getRoot();
    config.options().copyDefaults(true);
    config.set("version", plugin.version);
    plugin.saveConfig();

    // Load values
    CommandFilter = config.getStringList("command-filter");
    BlockFilter = config.getStringList("block-filter");
    IgnoreWorlds = config.getStringList("ignore-worlds");
    MaxLines = config.getInt("general.max-lines");
    MaxRadius = config.getInt("general.max-radius");
    DefaultHereRadius = config.getInt("general.default-here-radius");
    ToolBlock = config.getString("general.tool-block");
    DefaultToolCommand = config.getString("general.default-tool-command").split(" ");
    CleanseAge = config.getString("general.cleanse-age");
    CleansePeriod = config.getString("general.cleanse-period");
    SuperPick = config.getBoolean("log.super-pickaxe");
    GiveTool = config.getBoolean("general.give-user-tool");
    CheckUpdates = config.getBoolean("general.check-for-updates");
    Debug = config.getBoolean("general.debug");
    LogIpAddresses = config.getBoolean("general.log-ip-addresses");
    DeleteDataOnRollback = config.getBoolean("general.delete-data-on-rollback");
    LogDeathDrops = config.getBoolean("general.log-item-drops-on-death");
    OpPermissions = config.getBoolean("general.op-permissions");
    LogDelay = config.getInt("general.log-delay");
    DbUser = config.getString("mysql.username");
    DbPassword = config.getString("mysql.password");
    DbUrl =
        "jdbc:mysql://"
            + config.getString("mysql.hostname")
            + ":"
            + config.getInt("mysql.port")
            + "/"
            + config.getString("mysql.database");
    DbDatabase = config.getString("mysql.database");
    DbHawkEyeTable = config.getString("mysql.hawkeye-table");
    DbPlayerTable = config.getString("mysql.player-table");
    DbWorldTable = config.getString("mysql.world-table");
    PoolSize = config.getInt("mysql.max-connections");

    try {
      DebugLevel = Util.DebugLevel.valueOf(config.getString("general.debug-level").toUpperCase());
    } catch (Exception ex) {
      DebugLevel = Util.DebugLevel.NONE;
    }
  }
Exemplo n.º 2
0
  @Override
  public boolean execute() {
    Util.sendMessage(sender, "&c-----------&8[ &7Reload Process Started &8]&c-----------");

    HawkEye hawk = HawkEye.instance;

    hawk.reloadConfig();
    hawk.config = new Config(hawk);

    for (DataType dt : DataType.values()) {
      dt.reload();
    }

    Util.sendMessage(sender, "&8|  &7- &cConfig has been reloaded..");

    HandlerList.unregisterAll(hawk); // Unregisters all listeners registered to hawkeye

    hawk.registerListeners(Bukkit.getPluginManager());

    Util.sendMessage(sender, "&8|  &7- &cListeners have been reloaded..");

    Util.sendMessage(sender, "&c-----------&8[ &7Reload Process Finished &8]&c-----------");
    return true;
  }