コード例 #1
0
ファイル: BottomLine.java プロジェクト: Banjo-226/bottom-line
  protected void setup() {
    commands();
    config();
    new Store();
    new Util();
    new Permissions();

    if (getConfig().getBoolean("metrics") == true) {
      try {
        HttpURLConnection url = (HttpURLConnection) new URL("http://mcstats.org").openConnection();
        url.setRequestMethod("HEAD");
        url.setConnectTimeout(5000);
        int response = url.getResponseCode();

        if (response == HttpURLConnection.HTTP_OK) {
          Metrics m = new Metrics(this);
          m.start();

          debug("Started metrics!");
        } else {
          warning("Metrics is currently down (response code " + response + ")");
        }
      } catch (Exception e) {
        warning("Could not connect to metrics; server is most likely down!");
      }
    }

    if (Bukkit.getServer().getPluginManager().getPlugin("Vault") != null) {
      debug("Enabled Vault connection!");
      Bukkit.getServicesManager()
          .register(Economy.class, new VaultConnector(), this, ServicePriority.Highest);
    } else {
      error(
          "Could not find vault! This plugin can no longer find Vault and may throw errors into console. It is highly recommended you download vault.");
    }
  }