Esempio n. 1
0
 public static void debug(String s, long start) {
   if (DEBUG) {
     Bukkit.getLogger()
         .log(
             Level.INFO,
             "At {0}. Time since start: {1}ms",
             new Object[] {s, (System.currentTimeMillis() - start)});
   }
 }
Esempio n. 2
0
  @Override
  public void onEnable() {
    long start = System.currentTimeMillis();
    instance = this;
    loadConfig();
    DEBUG = getConfig().getBoolean("debug", false);
    debug("config", System.currentTimeMillis());
    vaultData = new File(this.getDataFolder(), "uuidvaults");
    debug("vaultdata", System.currentTimeMillis());
    getServer()
        .getScheduler()
        .runTask(this, new UUIDConversion()); // Convert to UUIDs first. Class checks if necessary.
    debug("uuid conversion", System.currentTimeMillis());
    loadLang();
    debug("lang", System.currentTimeMillis());
    new UUIDVaultManager();
    debug("uuidvaultmanager", System.currentTimeMillis());
    getServer().getPluginManager().registerEvents(new Listeners(this), this);
    getServer().getPluginManager().registerEvents(new VaultPreloadListener(), this);
    debug("registering listeners", System.currentTimeMillis());
    this.backupsEnabled = this.getConfig().getBoolean("backups.enabled", true);
    loadSigns();
    debug("loaded signs", System.currentTimeMillis());
    checkUpdate();
    debug("check update", System.currentTimeMillis());
    getCommand("pv").setExecutor(new VaultCommand());
    getCommand("pvdel").setExecutor(new DeleteCommand());
    getCommand("workbench").setExecutor(new WorkbenchCommand());
    getCommand("pvconvert").setExecutor(new ConvertCommand());
    debug("registered commands", System.currentTimeMillis());
    useVault = setupEconomy();
    debug("setup economy", System.currentTimeMillis());

    if (getConfig().getBoolean("cleanup.enable", false)) {
      getServer()
          .getScheduler()
          .runTaskAsynchronously(this, new Cleanup(getConfig().getInt("cleanup.lastEdit", 30)));
      debug("cleanup task", System.currentTimeMillis());
    }

    new BukkitRunnable() {
      @Override
      public void run() {
        if (saveQueued) {
          saveSignsFile();
        }
      }
    }.runTaskTimer(this, 20, 20);

    debug("enable done", System.currentTimeMillis());
  }