コード例 #1
0
  @Override
  public boolean isEnabled() {
    if (statsApi == null) {
      plugin.getLogger().info("Statistics (by bitWolfy) api library was not found!");
      return false;
    }

    if (!statsApi.isAvailable()) {
      plugin.getLogger().info("Statistics (by bitWolfy) is not enabled!");
      return false;
    }

    return true;
  }
コード例 #2
0
  private void sqlSetup(SimpleYamlConfiguration config) {
    ConfigurationSection s = config.getConfigurationSection("sql");

    Boolean enabled = s.getBoolean("enabled");
    if (enabled != null && enabled) {

      String hostname = s.getString("hostname");
      String username = s.getString("username");
      String password = s.getString("password");
      String database = s.getString("database");
      this.table = s.getString("table");

      this.sql = new SQLDataStorage(hostname, username, password, database);
      if (!sql.connect()) {
        this.sql = null;
        plugin.getLogger().severe("Could not connect to " + hostname);
      } else {
        plugin.getLogger().info("Successfully established connection to " + hostname);
      }
    }
  }
コード例 #3
0
ファイル: Playtimes.java プロジェクト: WrRonald/Autorank-2
  public Playtimes(Autorank plugin) {
    this.plugin = plugin;

    INTERVAL_MINUTES = plugin.getAdvancedConfig().getInt("interval check", 5);
    plugin.getLogger().info("Interval check every " + INTERVAL_MINUTES + " minutes.");

    this.data = new SimpleYamlConfiguration(plugin, "Data.yml", null, "Data");
    this.save = new PlaytimesSave(this);
    this.update = new PlaytimesUpdate(this, plugin);

    plugin.getServer().getScheduler().runTaskTimer(plugin, save, 12000, 12000);
    plugin.getServer().getScheduler().runTaskTimer(plugin, save, 600, 600);
    plugin
        .getServer()
        .getScheduler()
        .runTaskTimer(plugin, update, INTERVAL_MINUTES * 20 * 60, INTERVAL_MINUTES * 20 * 60);
  }
コード例 #4
0
ファイル: API.java プロジェクト: robocoder99/Autorank-2
  /**
   * Register a result that can be used in the advanced config. The name should be unique as that is
   * the way Autorank will identify the result.
   *
   * <p>The name will be the name that is used in the config.
   *
   * @param uniqueName Unique name identifier for the result
   * @param clazz Result class that does all the logic
   */
  public void registerResult(String uniqueName, Class<? extends Result> clazz) {
    plugin.getLogger().info("Loaded custom result: " + uniqueName);

    plugin.registerResult(uniqueName, clazz);
  }