@Override public void onEnable() { PM = getServer().getPluginManager(); LOG = getLogger(); getCommand("obsidiandestroyer").setExecutor(cmdExecutor); getCommand("od").setExecutor(cmdExecutor); config.loadConfig(); entityListener.setObsidianDurability(config.loadDurabilityFromFile()); checkFactionsHook(); checkTownyHook(); checkWorldGuardGHook(); PM.registerEvents(entityListener, this); PM.registerEvents(joinListener, this); startMetrics(); if (config.getCheckUpdate()) { Updater updater = new Updater( this, "obsidiandestroyer", this.getFile(), Updater.UpdateType.NO_DOWNLOAD, false); UPDATE = updater.getResult() == Updater.UpdateResult.UPDATE_AVAILABLE; NAME = updater.getLatestVersionString(); } }
private void resetDurability(Player sender) { ODEntityListener listener = plugin.getListener(); listener.setObsidianDurability(new HashMap<Integer, Integer>()); Set<Integer> set = listener.getObsidianTimer().keySet(); for (Integer i : set) { Timer t = listener.getObsidianTimer().get(i); if (t != null) { t.cancel(); } } listener.setObsidianTimer(new HashMap<Integer, Timer>()); Log.info("'" + sender.getName() + "' requested reset of Obsidian durabilities"); sender.sendMessage(ChatColor.GREEN + "Reset all Obsidian durabilities!"); }