SHARE
TWEET

Untitled

a guest Jun 18th, 2017 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     @Override
  2.     public void onEnable() {
  3.         anni = this;
  4.         configManager = new ConfigManager(this);
  5.         configManager.loadConfigFiles("config.yml", "maps.yml", "shops.yml",
  6.                 "stats.yml");
  7.  
  8.         MapLoader mapLoader = new MapLoader(getLogger(), getDataFolder());
  9.  
  10.         runCommand = getConfig().contains("commandsToRunAtEndGame");
  11.  
  12.         if (runCommand) {
  13.             commands = getConfig().getStringList("commandsToRunAtEndGame");
  14.         } else commands = null;
  15.  
  16.         maps = new MapManager(this, mapLoader,
  17.                 configManager.getConfig("maps.yml"));
  18.  
  19.         Configuration shops = configManager.getConfig("shops.yml");
  20.         new Shop(this, "Weapon", shops);
  21.         new Shop(this, "Brewing", shops);
  22.         stats = new StatsManager(this, configManager);
  23.         resources = new ResourceListener(this);
  24.         enderFurnaces = new EnderFurnaceListener(this);
  25.         enderBrewingStands = new EnderBrewingStandListener(this);
  26.         enderChests = new EnderChestListener();
  27.         sign = new SignManager(this);
  28.         Configuration config = configManager.getConfig("config.yml");
  29.         portal = new HashMap<Player, String>();
  30.         timer = new PhaseManager(this, config.getInt("start-delay"),
  31.                 config.getInt("phase-period"));
  32.         voting = new VotingManager(this);
  33.         sb = new ScoreboardManager();
  34.         boss = new BossManager(this);
  35.  
  36.         PluginManager pm = getServer().getPluginManager();
  37.  
  38.         sign.loadSigns();
  39.  
  40.         String sbb = this.getConfig().getString("LobbySB").replace("&", "ยง");
  41.         sb.resetScoreboard(sbb);
  42.  
  43.         build = this.getConfig().getInt("build", 5);
  44.         lastJoinPhase = this.getConfig().getInt("lastJoinPhase", 2);
  45.         respawn = this.getConfig().getInt("bossRespawnDelay", 10);
  46.  
  47.         pm.registerEvents(resources, this);
  48.         pm.registerEvents(enderFurnaces, this);
  49.         pm.registerEvents(new EnderFurnaceListener(this), this);
  50.         pm.registerEvents(enderBrewingStands, this);
  51.         pm.registerEvents(enderChests, this);
  52.         pm.registerEvents(new ChatListener(this), this);
  53.         pm.registerEvents(new PlayerListener(this), this);
  54.         pm.registerEvents(new WorldListener(), this);
  55.         pm.registerEvents(new SoulboundListener(), this);
  56.         pm.registerEvents(new WandListener(this), this);
  57.         pm.registerEvents(new CraftingListener(), this);
  58.         pm.registerEvents(new ClassAbilityListener(this), this);
  59.         pm.registerEvents(new BossListener(this), this);
  60.  
  61.         getCommand("annihilation").setExecutor(new AnniCommand(this));
  62.         getCommand("class").setExecutor(new ClassCommand(this));
  63.         getCommand("stats").setExecutor(new StatsCommand(stats));
  64.         getCommand("team").setExecutor(new TeamCommand(this));
  65.         getCommand("vote").setExecutor(new VoteCommand(voting));
  66.         getCommand("red").setExecutor(new TeamShortcutCommand());
  67.         getCommand("green").setExecutor(new TeamShortcutCommand());
  68.         getCommand("yellow").setExecutor(new TeamShortcutCommand());
  69.         getCommand("blue").setExecutor(new TeamShortcutCommand());
  70.         getCommand("distance").setExecutor(new DistanceCommand(this));
  71.         getCommand("map").setExecutor(new MapCommand(this, mapLoader));
  72.  
  73.         if (config.getString("stats").equalsIgnoreCase("sql"))
  74.             useMysql = true;
  75.  
  76.         motd = config.getBoolean("enableMotd", true);
  77.  
  78.         if (useMysql) {
  79.             String host = config.getString("MySQL.host");
  80.             Integer port = config.getInt("MySQL.port");
  81.             String name = config.getString("MySQL.name");
  82.             String user = config.getString("MySQL.user");
  83.             String pass = config.getString("MySQL.pass");
  84.             db = new DatabaseManager(host, port, name, user, pass, this);
  85.  
  86.             db.query("CREATE TABLE IF NOT EXISTS `" + mysqlName + "` ( `username` varchar(16) NOT NULL, "
  87.                     + "`kills` int(16) NOT NULL, `deaths` int(16) NOT NULL, `wins` int(16) NOT NULL, "
  88.                     + "`losses` int(16) NOT NULL, `nexus_damage` int(16) NOT NULL, "
  89.                     + "UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
  90.         } else
  91.             db = new DatabaseManager(this);
  92.  
  93.         if (getServer().getPluginManager().isPluginEnabled("Vault")) {
  94.             VaultHooks.vault = true;
  95.             if (!VaultHooks.instance().setupPermissions()) {
  96.                 VaultHooks.vault = false;
  97.                 getLogger().warning("Unable to load Vault: No permission plugin found.");
  98.             } else {
  99.                 if (!VaultHooks.instance().setupChat()) {
  100.                     VaultHooks.vault = false;
  101.                     getLogger().warning("Unable to load Vault: No chat plugin found.");
  102.                 } else {
  103.                     getLogger().info("Vault hook initalized!");
  104.                 }
  105.             }
  106.         } else {
  107.             getLogger().warning("Vault not found! Permissions features disabled.");
  108.         }
  109.  
  110.         reset();
  111.  
  112.         ChatUtil.setRoman(getConfig().getBoolean("roman", false));
  113.     }
  114.  
  115.     public boolean startTimer() {
  116.         if (timer.isRunning())
  117.             return false;
  118.  
  119.         timer.start();
  120.  
  121.         return true;
  122.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top