Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onEnable() {
- anni = this;
- configManager = new ConfigManager(this);
- configManager.loadConfigFiles("config.yml", "maps.yml", "shops.yml",
- "stats.yml");
- MapLoader mapLoader = new MapLoader(getLogger(), getDataFolder());
- runCommand = getConfig().contains("commandsToRunAtEndGame");
- if (runCommand) {
- commands = getConfig().getStringList("commandsToRunAtEndGame");
- } else commands = null;
- maps = new MapManager(this, mapLoader,
- configManager.getConfig("maps.yml"));
- Configuration shops = configManager.getConfig("shops.yml");
- new Shop(this, "Weapon", shops);
- new Shop(this, "Brewing", shops);
- stats = new StatsManager(this, configManager);
- resources = new ResourceListener(this);
- enderFurnaces = new EnderFurnaceListener(this);
- enderBrewingStands = new EnderBrewingStandListener(this);
- enderChests = new EnderChestListener();
- sign = new SignManager(this);
- Configuration config = configManager.getConfig("config.yml");
- portal = new HashMap<Player, String>();
- timer = new PhaseManager(this, config.getInt("start-delay"),
- config.getInt("phase-period"));
- voting = new VotingManager(this);
- sb = new ScoreboardManager();
- boss = new BossManager(this);
- PluginManager pm = getServer().getPluginManager();
- sign.loadSigns();
- String sbb = this.getConfig().getString("LobbySB").replace("&", "§");
- sb.resetScoreboard(sbb);
- build = this.getConfig().getInt("build", 5);
- lastJoinPhase = this.getConfig().getInt("lastJoinPhase", 2);
- respawn = this.getConfig().getInt("bossRespawnDelay", 10);
- pm.registerEvents(resources, this);
- pm.registerEvents(enderFurnaces, this);
- pm.registerEvents(new EnderFurnaceListener(this), this);
- pm.registerEvents(enderBrewingStands, this);
- pm.registerEvents(enderChests, this);
- pm.registerEvents(new ChatListener(this), this);
- pm.registerEvents(new PlayerListener(this), this);
- pm.registerEvents(new WorldListener(), this);
- pm.registerEvents(new SoulboundListener(), this);
- pm.registerEvents(new WandListener(this), this);
- pm.registerEvents(new CraftingListener(), this);
- pm.registerEvents(new ClassAbilityListener(this), this);
- pm.registerEvents(new BossListener(this), this);
- getCommand("annihilation").setExecutor(new AnniCommand(this));
- getCommand("class").setExecutor(new ClassCommand(this));
- getCommand("stats").setExecutor(new StatsCommand(stats));
- getCommand("team").setExecutor(new TeamCommand(this));
- getCommand("vote").setExecutor(new VoteCommand(voting));
- getCommand("red").setExecutor(new TeamShortcutCommand());
- getCommand("green").setExecutor(new TeamShortcutCommand());
- getCommand("yellow").setExecutor(new TeamShortcutCommand());
- getCommand("blue").setExecutor(new TeamShortcutCommand());
- getCommand("distance").setExecutor(new DistanceCommand(this));
- getCommand("map").setExecutor(new MapCommand(this, mapLoader));
- if (config.getString("stats").equalsIgnoreCase("sql"))
- useMysql = true;
- motd = config.getBoolean("enableMotd", true);
- if (useMysql) {
- String host = config.getString("MySQL.host");
- Integer port = config.getInt("MySQL.port");
- String name = config.getString("MySQL.name");
- String user = config.getString("MySQL.user");
- String pass = config.getString("MySQL.pass");
- db = new DatabaseManager(host, port, name, user, pass, this);
- db.query("CREATE TABLE IF NOT EXISTS `" + mysqlName + "` ( `username` varchar(16) NOT NULL, "
- + "`kills` int(16) NOT NULL, `deaths` int(16) NOT NULL, `wins` int(16) NOT NULL, "
- + "`losses` int(16) NOT NULL, `nexus_damage` int(16) NOT NULL, "
- + "UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
- } else
- db = new DatabaseManager(this);
- if (getServer().getPluginManager().isPluginEnabled("Vault")) {
- VaultHooks.vault = true;
- if (!VaultHooks.instance().setupPermissions()) {
- VaultHooks.vault = false;
- getLogger().warning("Unable to load Vault: No permission plugin found.");
- } else {
- if (!VaultHooks.instance().setupChat()) {
- VaultHooks.vault = false;
- getLogger().warning("Unable to load Vault: No chat plugin found.");
- } else {
- getLogger().info("Vault hook initalized!");
- }
- }
- } else {
- getLogger().warning("Vault not found! Permissions features disabled.");
- }
- reset();
- ChatUtil.setRoman(getConfig().getBoolean("roman", false));
- }
- public boolean startTimer() {
- if (timer.isRunning())
- return false;
- timer.start();
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement