@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(); } }
@SuppressWarnings("unused") @EventHandler public void onPlayerJoin(PlayerJoinEvent e) { BukkitTask task = new Expire(e, this).runTaskLater(this, 20); if (this.getConfig().getBoolean("update-check") || this.getConfig().getString("update-check").equals("true")) { if (e.getPlayer().hasPermission("donexpress.admin.update")) { String thisVersion = getDescription().getVersion(); Updater updater = new Updater( this, 59496, this.getFile(), Updater.UpdateType.NO_DOWNLOAD, false); // Start Updater but just do a version check update = updater.getResult() == Updater.UpdateResult .UPDATE_AVAILABLE; // Determine if there is an update ready for us name = updater.getLatestName(); // Get the latest version if (update) { e.getPlayer().sendMessage(ChatColor.YELLOW + "An update for DonatorExpress is available"); e.getPlayer().sendMessage(ChatColor.YELLOW + "New version: " + name); e.getPlayer().sendMessage(ChatColor.YELLOW + "Your version: " + thisVersion); e.getPlayer() .sendMessage( ChatColor.YELLOW + "Download it here: http://dev.bukkit.org/bukkit-plugins/donator-express"); } } } }