public void onDisable() { if (!CrankedPlayerManager.getPlayers().isEmpty()) for (CrankedPlayer cp : CrankedPlayerManager.getPlayers()) { if (cp.getArena() != null) { cp.getPlayer().sendMessage(Msgs.Error_Plugin_Unload.getString()); cp.reset(); } } if (getConfig().getBoolean("MySQL.Enable")) { MySQL.closeConnection(); } }
public void onEnable() { me = this; // Register the event listeners getServer().getPluginManager().registerEvents(listeners, this); getCommand("Cranked").setExecutor(new Commands(this)); // Create the default config.yml getConfig().options().copyDefaults(); saveConfig(); for (Player p : Bukkit.getOnlinePlayers()) { CrankedPlayer cp = new CrankedPlayer(p); CrankedPlayerManager.loadCrackedPlayer(cp); } if (Files.getArenas().getConfigurationSection("Arenas") != null) for (String s : Files.getArenas().getConfigurationSection("Arenas").getKeys(false)) { Arena arena = new Arena(StringUtil.getWord(s)); ArenaManager.loadArena(arena); System.out.println("Loaded Arena: " + arena); } else System.out.println("Couldn't Loaded Any Arenas"); if (getConfig().getBoolean("MySQL.Enable")) { MySQL = new MySQL( this, getConfig().getString("MySQL.Host"), getConfig().getString("MySQL.Port"), getConfig().getString("MySQL.Database"), getConfig().getString("MySQL.User"), getConfig().getString("MySQL.Pass")); c = MySQL.openConnection(); } }