Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.42 KB | None | 0 0
  1. package com.zeflyyt.hcf;
  2.  
  3. import java.io.File;
  4. import java.text.DecimalFormat;
  5. import java.util.Arrays;
  6. import java.util.Map;
  7. import java.util.Random;
  8. import java.util.concurrent.TimeUnit;
  9. import java.util.stream.Collectors;
  10.  
  11. import org.apache.commons.lang3.time.DurationFormatUtils;
  12. import org.bukkit.Bukkit;
  13. import org.bukkit.command.CommandExecutor;
  14. import org.bukkit.command.PluginCommand;
  15. import org.bukkit.configuration.file.FileConfiguration;
  16. import org.bukkit.configuration.serialization.ConfigurationSerialization;
  17. import org.bukkit.entity.Player;
  18. import org.bukkit.plugin.Plugin;
  19. import org.bukkit.plugin.PluginManager;
  20. import org.bukkit.plugin.java.JavaPlugin;
  21. import org.bukkit.scheduler.BukkitRunnable;
  22.  
  23. import com.sk89q.worldedit.bukkit.WorldEditPlugin;
  24. import com.zeflyyt.hcf.balance.EconomyCommand;
  25. import com.zeflyyt.hcf.balance.EconomyManager;
  26. import com.zeflyyt.hcf.balance.FlatFileEconomyManager;
  27. import com.zeflyyt.hcf.balance.PayCommand;
  28. import com.zeflyyt.hcf.balance.ShopSignListener;
  29. import com.zeflyyt.hcf.classes.PvpClassManager;
  30. import com.zeflyyt.hcf.classes.archer.ArcherClass;
  31. import com.zeflyyt.hcf.classes.bard.BardRestorer;
  32. import com.zeflyyt.hcf.classes.type.RogueClass;
  33. import com.zeflyyt.hcf.combatlog.CombatLogListener;
  34. import com.zeflyyt.hcf.combatlog.CustomEntityRegistration;
  35. import com.zeflyyt.hcf.commands.BroadcastCommand;
  36. import com.zeflyyt.hcf.commands.ClearCommand;
  37. import com.zeflyyt.hcf.commands.CobbleCommand;
  38. import com.zeflyyt.hcf.commands.CoordsCommand;
  39. import com.zeflyyt.hcf.commands.CrowbarCommand;
  40. import com.zeflyyt.hcf.commands.DiamondReviveCommand;
  41. import com.zeflyyt.hcf.commands.EnchantCommand;
  42. import com.zeflyyt.hcf.commands.EndPortalCommand;
  43. import com.zeflyyt.hcf.commands.FFACommand;
  44. import com.zeflyyt.hcf.commands.FeedCommand;
  45. import com.zeflyyt.hcf.commands.FixCommand;
  46. import com.zeflyyt.hcf.commands.FlyCommand;
  47. import com.zeflyyt.hcf.commands.FreezeCommand;
  48. import com.zeflyyt.hcf.commands.GMCCommand;
  49. import com.zeflyyt.hcf.commands.GMSCommand;
  50. import com.zeflyyt.hcf.commands.GameModeCommand;
  51. import com.zeflyyt.hcf.commands.GiveCommand;
  52. import com.zeflyyt.hcf.commands.GodCommand;
  53. import com.zeflyyt.hcf.commands.GoppleCommand;
  54. import com.zeflyyt.hcf.commands.HatCommand;
  55. import com.zeflyyt.hcf.commands.HealCommand;
  56. import com.zeflyyt.hcf.commands.HelpCommand;
  57. import com.zeflyyt.hcf.commands.HelpOpCommand;
  58. import com.zeflyyt.hcf.commands.InvSeeCommand;
  59. import com.zeflyyt.hcf.commands.ItemCommand;
  60. import com.zeflyyt.hcf.commands.KillCommand;
  61. import com.zeflyyt.hcf.commands.KingReviveCommand;
  62. import com.zeflyyt.hcf.commands.LFFCommand;
  63. import com.zeflyyt.hcf.commands.LagCommand;
  64. import com.zeflyyt.hcf.commands.ListCommand;
  65. import com.zeflyyt.hcf.commands.LockdownCommand;
  66. import com.zeflyyt.hcf.commands.LogoutCommand;
  67. import com.zeflyyt.hcf.commands.MapKitCommand;
  68. import com.zeflyyt.hcf.commands.MessageCommand;
  69. import com.zeflyyt.hcf.commands.MiscCommands;
  70. import com.zeflyyt.hcf.commands.MoreCommand;
  71. import com.zeflyyt.hcf.commands.OreStatsCommand;
  72. import com.zeflyyt.hcf.commands.PanicCommand;
  73. import com.zeflyyt.hcf.commands.PingCommand;
  74. import com.zeflyyt.hcf.commands.PlayTimeCommand;
  75. import com.zeflyyt.hcf.commands.PlayerVaultCommand;
  76. import com.zeflyyt.hcf.commands.PvpTimerCommand;
  77. import com.zeflyyt.hcf.commands.RandomCommand;
  78. import com.zeflyyt.hcf.commands.RankCommand;
  79. import com.zeflyyt.hcf.commands.RefundCommand;
  80. import com.zeflyyt.hcf.commands.RenameCommand;
  81. import com.zeflyyt.hcf.commands.ReplyCommand;
  82. import com.zeflyyt.hcf.commands.ReportCommand;
  83. import com.zeflyyt.hcf.commands.ResetCommand;
  84. import com.zeflyyt.hcf.commands.SetBorderCommand;
  85. import com.zeflyyt.hcf.commands.SetCommand;
  86. import com.zeflyyt.hcf.commands.SetKBCommand;
  87. import com.zeflyyt.hcf.commands.SkullCommand;
  88. import com.zeflyyt.hcf.commands.SpawnCommand;
  89. import com.zeflyyt.hcf.commands.SpawnerCommand;
  90. import com.zeflyyt.hcf.commands.StaffChatCommand;
  91. import com.zeflyyt.hcf.commands.StaffModeCommand;
  92. import com.zeflyyt.hcf.commands.StatsCommand;
  93. import com.zeflyyt.hcf.commands.SudoCommand;
  94. import com.zeflyyt.hcf.commands.TLCommand;
  95. import com.zeflyyt.hcf.commands.TeamspeakCommand;
  96. import com.zeflyyt.hcf.commands.TeleportAllCommand;
  97. import com.zeflyyt.hcf.commands.TeleportCommand;
  98. import com.zeflyyt.hcf.commands.TeleportHereCommand;
  99. import com.zeflyyt.hcf.commands.ToggleMessageCommand;
  100. import com.zeflyyt.hcf.commands.TopCommand;
  101. import com.zeflyyt.hcf.commands.VanishCommand;
  102. import com.zeflyyt.hcf.commands.WhoisCommand;
  103. import com.zeflyyt.hcf.commands.WorldCommand;
  104. import com.zeflyyt.hcf.config.PlayerData;
  105. import com.zeflyyt.hcf.config.PotionLimiterData;
  106. import com.zeflyyt.hcf.config.WorldData;
  107. import com.zeflyyt.hcf.deathban.Deathban;
  108. import com.zeflyyt.hcf.deathban.DeathbanListener;
  109. import com.zeflyyt.hcf.deathban.DeathbanManager;
  110. import com.zeflyyt.hcf.deathban.FlatFileDeathbanManager;
  111. import com.zeflyyt.hcf.deathban.lives.LivesExecutor;
  112. import com.zeflyyt.hcf.deathban.lives.StaffReviveCommand;
  113. import com.zeflyyt.hcf.doublekeys.DoubleKeyCommand;
  114. import com.zeflyyt.hcf.doublekeys.DoubleKeyListener;
  115. import com.zeflyyt.hcf.event.CaptureZone;
  116. import com.zeflyyt.hcf.event.EventExecutor;
  117. import com.zeflyyt.hcf.event.EventScheduler;
  118. import com.zeflyyt.hcf.event.conquest.ConquestExecutor;
  119. import com.zeflyyt.hcf.event.eotw.EOTWHandler;
  120. import com.zeflyyt.hcf.event.eotw.EotwCommand;
  121. import com.zeflyyt.hcf.event.eotw.EotwListener;
  122. import com.zeflyyt.hcf.event.faction.CapturableFaction;
  123. import com.zeflyyt.hcf.event.faction.ConquestFaction;
  124. import com.zeflyyt.hcf.event.faction.KothFaction;
  125. import com.zeflyyt.hcf.event.glmountain.GlowstoneMountain;
  126. import com.zeflyyt.hcf.event.koth.KothExecutor;
  127. import com.zeflyyt.hcf.faction.FactionExecutor;
  128. import com.zeflyyt.hcf.faction.FactionManager;
  129. import com.zeflyyt.hcf.faction.FactionMember;
  130. import com.zeflyyt.hcf.faction.FlatFileFactionManager;
  131. import com.zeflyyt.hcf.faction.claim.Claim;
  132. import com.zeflyyt.hcf.faction.claim.ClaimHandler;
  133. import com.zeflyyt.hcf.faction.claim.ClaimWandListener;
  134. import com.zeflyyt.hcf.faction.claim.Subclaim;
  135. import com.zeflyyt.hcf.faction.type.ClaimableFaction;
  136. import com.zeflyyt.hcf.faction.type.EndPortalFaction;
  137. import com.zeflyyt.hcf.faction.type.Faction;
  138. import com.zeflyyt.hcf.faction.type.GlowstoneFaction;
  139. import com.zeflyyt.hcf.faction.type.PlayerFaction;
  140. import com.zeflyyt.hcf.faction.type.RoadFaction;
  141. import com.zeflyyt.hcf.faction.type.SpawnFaction;
  142. import com.zeflyyt.hcf.inventory.implementation.ClaimSettingsInventory;
  143. import com.zeflyyt.hcf.keyall.KeyAllCommand;
  144. import com.zeflyyt.hcf.keyall.KeyAllListener;
  145. import com.zeflyyt.hcf.keysale.KeySaleCommand;
  146. import com.zeflyyt.hcf.keysale.KeySaleListener;
  147. import com.zeflyyt.hcf.listener.AutoSmeltOreListener;
  148. import com.zeflyyt.hcf.listener.BookDeenchantListener;
  149. import com.zeflyyt.hcf.listener.BorderListener;
  150. import com.zeflyyt.hcf.listener.BottledExpListener;
  151. import com.zeflyyt.hcf.listener.ChatListener;
  152. import com.zeflyyt.hcf.listener.CoreListener;
  153. import com.zeflyyt.hcf.listener.CrowbarListener;
  154. import com.zeflyyt.hcf.listener.DeathListener;
  155. import com.zeflyyt.hcf.listener.DeathMessageListener;
  156. import com.zeflyyt.hcf.listener.ElevatorListener;
  157. import com.zeflyyt.hcf.listener.EnderPearlFix;
  158. import com.zeflyyt.hcf.listener.EntityLimitListener;
  159. import com.zeflyyt.hcf.listener.ExpMultiplierListener;
  160. import com.zeflyyt.hcf.listener.FactionListener;
  161. import com.zeflyyt.hcf.listener.FactionsCoreListener;
  162. import com.zeflyyt.hcf.listener.FoundDiamondsListener;
  163. import com.zeflyyt.hcf.listener.FurnaceSmeltSpeederListener;
  164. import com.zeflyyt.hcf.listener.GodListener;
  165. import com.zeflyyt.hcf.listener.KitMapListener;
  166. import com.zeflyyt.hcf.listener.LoginEvent;
  167. import com.zeflyyt.hcf.listener.OreCountListener;
  168. import com.zeflyyt.hcf.listener.PearlGlitchListener;
  169. import com.zeflyyt.hcf.listener.PlayTimeManager;
  170. import com.zeflyyt.hcf.listener.PotionLimitListener;
  171. import com.zeflyyt.hcf.listener.SignSubclaimListener;
  172. import com.zeflyyt.hcf.listener.SkullListener;
  173. import com.zeflyyt.hcf.listener.StaffChatListener;
  174. import com.zeflyyt.hcf.listener.StaffModeListener;
  175. import com.zeflyyt.hcf.listener.UnRepairableListener;
  176. import com.zeflyyt.hcf.listener.VanishListener;
  177. import com.zeflyyt.hcf.listener.WorldListener;
  178. import com.zeflyyt.hcf.listener.fixes.ArmorFixListener;
  179. import com.zeflyyt.hcf.listener.fixes.BeaconStrengthFixListener;
  180. import com.zeflyyt.hcf.listener.fixes.BlockHitFixListener;
  181. import com.zeflyyt.hcf.listener.fixes.BlockJumpGlitchFixListener;
  182. import com.zeflyyt.hcf.listener.fixes.BoatGlitchFixListener;
  183. import com.zeflyyt.hcf.listener.fixes.BookQuillFixListener;
  184. import com.zeflyyt.hcf.listener.fixes.CommandBlocker;
  185. import com.zeflyyt.hcf.listener.fixes.DupeGlitchFix;
  186. import com.zeflyyt.hcf.listener.fixes.EnchantLimitListener;
  187. import com.zeflyyt.hcf.listener.fixes.EnderChestRemovalListener;
  188. import com.zeflyyt.hcf.listener.fixes.HungerFixListener;
  189. import com.zeflyyt.hcf.listener.fixes.InfinityArrowFixListener;
  190. import com.zeflyyt.hcf.listener.fixes.NaturalMobSpawnFixListener;
  191. import com.zeflyyt.hcf.listener.fixes.PexCrashFixListener;
  192. import com.zeflyyt.hcf.listener.fixes.PortalListener;
  193. import com.zeflyyt.hcf.listener.fixes.StrengthListener;
  194. import com.zeflyyt.hcf.listener.fixes.SyntaxBlocker;
  195. import com.zeflyyt.hcf.listener.fixes.VoidGlitchFixListener;
  196. import com.zeflyyt.hcf.listener.fixes.WeatherFixListener;
  197. import com.zeflyyt.hcf.reboot.RebootCommand;
  198. import com.zeflyyt.hcf.reboot.RebootListener;
  199. import com.zeflyyt.hcf.reclaim.ReclaimManager;
  200. import com.zeflyyt.hcf.sale.SaleCommand;
  201. import com.zeflyyt.hcf.sale.SaleListener;
  202. import com.zeflyyt.hcf.scoreboard.ScoreboardHandler;
  203. import com.zeflyyt.hcf.signs.EventSignListener;
  204. import com.zeflyyt.hcf.signs.KitSignListener;
  205. import com.zeflyyt.hcf.sotw.SotwCommand;
  206. import com.zeflyyt.hcf.sotw.SotwListener;
  207. import com.zeflyyt.hcf.sotw.SotwTimer;
  208. import com.zeflyyt.hcf.stattracker.OreTrackerListener;
  209. import com.zeflyyt.hcf.stattracker.StatTrackListener;
  210. import com.zeflyyt.hcf.tablist.TablistManager;
  211. import com.zeflyyt.hcf.tablist.tablist.TablistAdapter;
  212. import com.zeflyyt.hcf.timer.TimerExecutor;
  213. import com.zeflyyt.hcf.timer.TimerManager;
  214. import com.zeflyyt.hcf.tripplekeys.TrippleKeyCommand;
  215. import com.zeflyyt.hcf.tripplekeys.TrippleKeyListener;
  216. import com.zeflyyt.hcf.user.ConsoleUser;
  217. import com.zeflyyt.hcf.user.FactionUser;
  218. import com.zeflyyt.hcf.user.UserManager;
  219. import com.zeflyyt.hcf.util.SignHandler;
  220. import com.zeflyyt.hcf.util.itemdb.ItemDb;
  221. import com.zeflyyt.hcf.util.itemdb.SimpleItemDb;
  222. import com.zeflyyt.hcf.visualise.ProtocolLibHook;
  223. import com.zeflyyt.hcf.visualise.VisualiseHandler;
  224. import com.zeflyyt.hcf.visualise.WallBorderListener;
  225. import com.zeflyyt.hcf.weekendsale.WeekendSaleCommand;
  226. import com.zeflyyt.hcf.weekendsale.WeekendSaleListener;
  227.  
  228. import lombok.Getter;
  229. import net.md_5.bungee.api.ChatColor;
  230. import net.milkbowl.vault.chat.Chat;
  231. import net.minecraft.util.com.google.common.base.Joiner;
  232.  
  233. public class Base extends JavaPlugin implements CommandExecutor {
  234.  
  235. private CombatLogListener combatLogListener;
  236.  
  237. public CombatLogListener getCombatLogListener() {
  238. return this.combatLogListener;
  239. }
  240.  
  241. @Getter
  242. private Chat chat;
  243.  
  244. @Getter
  245. private ClaimSettingsInventory claimSettings;
  246.  
  247. public void onEnable() {
  248. plugin = this;
  249.  
  250.  
  251.  
  252.  
  253. BasePlugins.getPlugin().init(this);
  254. config = getConfig();
  255. config.options().copyDefaults(true);
  256. saveConfig();
  257. conf = new File(getDataFolder(), "config.yml");
  258. WorldData.getInstance().setup(this);
  259. PlayerData.getInstance().setup(this);
  260. PotionLimiterData.getInstance().setup(this);
  261. Bukkit.getConsoleSender()
  262. .sendMessage(ChatColor.GREEN.toString() + ChatColor.ITALIC + "aHCF is now enabled.");
  263. Bukkit.getConsoleSender()
  264. .sendMessage("");
  265. Bukkit.getConsoleSender()
  266. .sendMessage(ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "--------------------------------");
  267. Bukkit.getConsoleSender()
  268. .sendMessage(ChatColor.GREEN.toString() + "Made by Emirate & ZeflyYT");
  269. Bukkit.getConsoleSender()
  270. .sendMessage(ChatColor.GRAY.toString() + " If there is any bugs, or any issues please dm Emirate#9246 or Zefly#4954");
  271. Bukkit.getConsoleSender()
  272. .sendMessage(ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "--------------------------------");
  273. ProtocolLibHook.hook(this);
  274. CustomEntityRegistration.registerCustomEntities();
  275. Plugin wep = Bukkit.getPluginManager().getPlugin("WorldEdit");
  276. this.craftBukkitVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
  277. this.worldEdit = (((wep instanceof WorldEditPlugin)) && (wep.isEnabled()) ? (WorldEditPlugin) wep : null);
  278.  
  279. registerConfiguration();
  280. if(!new AdvancedLicense(Base.config.getString("HWID"), "https://ahcf.000webhostapp.com/verify.php", this).register()) return;
  281. registerCommands();
  282. registerManagers();
  283. registerListeners();
  284. this.claimSettings = new ClaimSettingsInventory(this);
  285. if ((ConfigurationService.TAB_LIST) == true) {
  286. new TablistManager(this, new TablistAdapter(this), TimeUnit.SECONDS.toMillis((long) 0.5));
  287. }
  288. Cooldowns.createCooldown("helpop_cooldown");
  289. Cooldowns.createCooldown("report_cooldown");
  290. Cooldowns.createCooldown("king_cooldown");
  291. Cooldowns.createCooldown("diamond_cooldown");
  292. Cooldowns.createCooldown("emerald_cooldown");
  293. Cooldowns.createCooldown("ruby_cooldown");
  294. Cooldowns.createCooldown("gold_cooldown");
  295. Cooldowns.createCooldown("archer_speed_cooldown");
  296. Cooldowns.createCooldown("archer_jump_cooldown");
  297. Cooldowns.createCooldown("rogue_speed_cooldown");
  298. Cooldowns.createCooldown("rogue_jump_cooldown");
  299. Cooldowns.createCooldown("rogue_cooldown");
  300. Cooldowns.createCooldown("lff_cooldown");
  301.  
  302. new BukkitRunnable() {
  303. public void run() {
  304. Base.this.saveData();
  305. getServer().broadcastMessage(ChatColor.AQUA + "Saving data...");
  306. }
  307. }.runTaskTimerAsynchronously(this, TimeUnit.SECONDS.toMillis(20L), TimeUnit.SECONDS.toMillis(20L));
  308.  
  309. new BukkitRunnable() {
  310.  
  311. @Override
  312. public void run() {
  313. @SuppressWarnings("deprecation")
  314. String players = Arrays.stream(Bukkit.getOnlinePlayers())
  315. .filter(player -> player.hasPermission("top.rank") && !player.isOp() && !player.hasPermission("*"))
  316. .map(Player::getName)
  317. .collect(Collectors.joining(", "));
  318.  
  319.  
  320. for (String onlinedonator : Base.config.getStringList("Online-Donator-Broadcast")) {
  321. getServer().broadcastMessage(ChatColor.translateAlternateColorCodes('&', onlinedonator).replace("%player%", players)); }
  322.  
  323. // getServer().broadcastMessage(ChatColor.YELLOW + "");
  324. // getServer().broadcastMessage(ConfigurationService.PRIMAIRY_COLOR + ConfigurationService.TOP_RANK + " Users " + ChatColor.GRAY + "» " + ChatColor.WHITE + players);
  325. // getServer().broadcastMessage(ChatColor.DARK_AQUA + "Purchase the " + ConfigurationService.TOP_RANK + " rank at " + ConfigurationService.DONATE_URL);
  326. // getServer().broadcastMessage(ChatColor.WHITE + ""); }
  327. }
  328. }.runTaskTimer(this, 60L, 20 * 60 * 5);
  329. }
  330.  
  331.  
  332.  
  333.  
  334. private void saveData() {
  335. this.combatLogListener.removeCombatLoggers();
  336. this.deathbanManager.saveDeathbanData();
  337. this.economyManager.saveEconomyData();
  338. this.factionManager.saveFactionData();
  339. this.playTimeManager.savePlaytimeData();
  340. this.userManager.saveUserData();
  341. this.signHandler.cancelTasks(null);
  342.  
  343. PlayerData.getInstance().saveConfig();
  344.  
  345. }
  346.  
  347. public void onDisable() {
  348. this.pvpClassManager.onDisable();
  349. this.scoreboardHandler.clearBoards();
  350. this.deathbanManager.saveDeathbanData();
  351. this.economyManager.saveEconomyData();
  352. this.factionManager.saveFactionData();
  353. this.playTimeManager.savePlaytimeData();
  354. this.userManager.saveUserData();
  355. StaffModeCommand.onDisableMod();
  356. saveData();
  357. plugin = null;
  358. }
  359.  
  360. private void registerConfiguration() {
  361. ConfigurationSerialization.registerClass(CaptureZone.class);
  362. ConfigurationSerialization.registerClass(Deathban.class);
  363. ConfigurationSerialization.registerClass(Claim.class);
  364. ConfigurationSerialization.registerClass(ConsoleUser.class);
  365. ConfigurationSerialization.registerClass(Subclaim.class);
  366. ConfigurationSerialization.registerClass(FactionUser.class);
  367. ConfigurationSerialization.registerClass(ClaimableFaction.class);
  368. ConfigurationSerialization.registerClass(ConquestFaction.class);
  369. ConfigurationSerialization.registerClass(CapturableFaction.class);
  370. ConfigurationSerialization.registerClass(KothFaction.class);
  371. ConfigurationSerialization.registerClass(GlowstoneFaction.class);
  372. ConfigurationSerialization.registerClass(EndPortalFaction.class);
  373. ConfigurationSerialization.registerClass(Faction.class);
  374. ConfigurationSerialization.registerClass(FactionMember.class);
  375. ConfigurationSerialization.registerClass(PlayerFaction.class);
  376. ConfigurationSerialization.registerClass(RoadFaction.class);
  377. ConfigurationSerialization.registerClass(SpawnFaction.class);
  378. ConfigurationSerialization.registerClass(RoadFaction.NorthRoadFaction.class);
  379. ConfigurationSerialization.registerClass(RoadFaction.EastRoadFaction.class);
  380. ConfigurationSerialization.registerClass(RoadFaction.SouthRoadFaction.class);
  381. ConfigurationSerialization.registerClass(RoadFaction.WestRoadFaction.class);
  382. }
  383.  
  384. private void registerListeners() {
  385. PluginManager manager = getServer().getPluginManager();
  386. manager.registerEvents(new OreStatsCommand(), this);
  387. manager.registerEvents(new GodListener(), this);
  388. manager.registerEvents(new VanishListener(), this);
  389. manager.registerEvents(new ArcherClass(this), this);
  390. manager.registerEvents(new RogueClass(this), this);
  391. manager.registerEvents(new PotionLimitListener(this), this);
  392. manager.registerEvents(new LoginEvent(), this);
  393. manager.registerEvents(new DupeGlitchFix(), this);
  394. manager.registerEvents(new PortalListener(this), this);
  395. manager.registerEvents(new WeatherFixListener(), this);
  396. manager.registerEvents(this.combatLogListener = new CombatLogListener(this), this);
  397. manager.registerEvents(new NaturalMobSpawnFixListener(), this);
  398. manager.registerEvents(new AutoSmeltOreListener(), this);
  399. manager.registerEvents(new BlockHitFixListener(), this);
  400. manager.registerEvents(new BlockJumpGlitchFixListener(), this);
  401. manager.registerEvents(new CommandBlocker(), this);
  402. manager.registerEvents(new BoatGlitchFixListener(), this);
  403. manager.registerEvents(new BookDeenchantListener(), this);
  404. manager.registerEvents(new PexCrashFixListener(this), this);
  405. manager.registerEvents(new BookQuillFixListener(this), this);
  406. manager.registerEvents(new BorderListener(), this);
  407. manager.registerEvents(new ChatListener(this), this);
  408. manager.registerEvents(new ClaimWandListener(this), this);
  409. manager.registerEvents(new BottledExpListener(), this);
  410. manager.registerEvents(new CoreListener(this), this);
  411. manager.registerEvents(new CrowbarListener(this), this);
  412. manager.registerEvents(new DeathListener(this), this);
  413. manager.registerEvents(new ElevatorListener(this), this);
  414. manager.registerEvents(new DeathMessageListener(this), this);
  415. if (ConfigurationService.KIT_MAP == false) {
  416.  
  417. manager.registerEvents(new DeathbanListener(this), this);
  418.  
  419. }
  420. manager.registerEvents(new EnchantLimitListener(), this);
  421. manager.registerEvents(new EnderChestRemovalListener(), this);
  422. manager.registerEvents(new FlatFileFactionManager(this), this);
  423. manager.registerEvents(new StrengthListener(), this);
  424. manager.registerEvents(new ArmorFixListener(), this);
  425. manager.registerEvents(new EotwListener(this), this);
  426. manager.registerEvents(new EventSignListener(), this);
  427. manager.registerEvents(new ExpMultiplierListener(), this);
  428. manager.registerEvents(new FactionListener(this), this);
  429. manager.registerEvents(new FoundDiamondsListener(this), this);
  430. manager.registerEvents(new FurnaceSmeltSpeederListener(), this);
  431. manager.registerEvents(new KitMapListener(this), this);
  432. manager.registerEvents(new InfinityArrowFixListener(), this);
  433. manager.registerEvents(new HungerFixListener(), this);
  434. manager.registerEvents(new PearlGlitchListener(this), this);
  435. manager.registerEvents(new FactionsCoreListener(this), this);
  436. manager.registerEvents(new PearlGlitchListener(this), this);
  437. manager.registerEvents(new EnderPearlFix(this), this);
  438. manager.registerEvents(new SignSubclaimListener(this), this);
  439. manager.registerEvents(new EndPortalCommand(getPlugin()), this);
  440. manager.registerEvents(new ShopSignListener(this), this);
  441. manager.registerEvents(new SkullListener(), this);
  442. manager.registerEvents(new BeaconStrengthFixListener(this), this);
  443. manager.registerEvents(new VoidGlitchFixListener(), this);
  444. manager.registerEvents(new WallBorderListener(this), this);
  445. manager.registerEvents(this.playTimeManager, this);
  446. manager.registerEvents(new WorldListener(this), this);
  447. manager.registerEvents(new UnRepairableListener(), this);
  448. manager.registerEvents(new StaffModeListener(), this);
  449. manager.registerEvents(new SyntaxBlocker(), this);
  450. manager.registerEvents(new OreTrackerListener(), this);
  451. manager.registerEvents(new OreCountListener(), this);
  452. manager.registerEvents(new SotwListener(this), this);
  453. manager.registerEvents(new KitSignListener(), this);
  454. manager.registerEvents(new RebootListener(), this);
  455. manager.registerEvents(new SaleListener(), this);
  456. manager.registerEvents(new KeySaleListener(), this);
  457. manager.registerEvents(new WeekendSaleListener(), this);
  458. manager.registerEvents(new KeyAllListener(), this);
  459. manager.registerEvents(new TrippleKeyListener(), this);
  460. manager.registerEvents(new DoubleKeyListener(), this);
  461. manager.registerEvents(new EntityLimitListener(this), this);
  462. manager.registerEvents(new StatTrackListener(), this);
  463. manager.registerEvents(new StaffChatListener(), this);
  464. }
  465.  
  466. private void registerCommands() {
  467.  
  468. getCommand("top").setExecutor(new TopCommand());
  469. getCommand("list").setExecutor(new ListCommand());
  470. getCommand("setborder").setExecutor(new SetBorderCommand());
  471. getCommand("helpop").setExecutor(new HelpOpCommand());
  472. getCommand("report").setExecutor(new ReportCommand());
  473. getCommand("hat").setExecutor(new HatCommand());
  474. getCommand("world").setExecutor(new WorldCommand());
  475. getCommand("endportal").setExecutor(new EndPortalCommand(getPlugin()));
  476. getCommand("fix").setExecutor(new FixCommand());
  477. getCommand("setkb").setExecutor(new SetKBCommand());
  478. getCommand("enchant").setExecutor(new EnchantCommand());
  479. getCommand("freeze").setExecutor(new FreezeCommand(this));
  480. getCommand("staffrevive").setExecutor(new StaffReviveCommand(this));
  481. getCommand("lag").setExecutor(new LagCommand());
  482. getCommand("broadcast").setExecutor(new BroadcastCommand());
  483. getCommand("togglemessage").setExecutor(new ToggleMessageCommand());
  484. getCommand("king").setExecutor(new KingReviveCommand(this));
  485. getCommand("reply").setExecutor(new ReplyCommand());
  486. getCommand("rank").setExecutor(new RankCommand());
  487. getCommand("message").setExecutor(new MessageCommand());
  488. getCommand("feed").setExecutor(new FeedCommand());
  489. getCommand("pv").setExecutor(new PlayerVaultCommand(this));
  490. getCommand("setspawn").setExecutor(new SpawnCommand());
  491. getCommand("ping").setExecutor(new PingCommand());
  492. getCommand("togglemessage").setExecutor(new ToggleMessageCommand());
  493. getCommand("teleportall").setExecutor(new TeleportAllCommand());
  494. getCommand("teleporthere").setExecutor(new TeleportHereCommand());
  495. getCommand("give").setExecutor(new GiveCommand());
  496. getCommand("gamemode").setExecutor(new GameModeCommand());
  497. getCommand("item").setExecutor(new ItemCommand());
  498. getCommand("lockdown").setExecutor(new LockdownCommand(this));
  499. getCommand("fly").setExecutor(new FlyCommand());
  500. getCommand("invsee").setExecutor(new InvSeeCommand(this));
  501. getCommand("god").setExecutor(new GodCommand());
  502. getCommand("gms").setExecutor(new GMSCommand());
  503. getCommand("gmc").setExecutor(new GMCCommand());
  504. getCommand("vanish").setExecutor(new VanishCommand());
  505. getCommand("sotw").setExecutor(new SotwCommand(this));
  506. getCommand("random").setExecutor(new RandomCommand(this));
  507. getCommand("conquest").setExecutor(new ConquestExecutor(this));
  508. getCommand("crowbar").setExecutor(new CrowbarCommand());
  509. getCommand("economy").setExecutor(new EconomyCommand(this));
  510. getCommand("eotw").setExecutor(new EotwCommand(this));
  511. getCommand("event").setExecutor(new EventExecutor(this));
  512. getCommand("faction").setExecutor(new FactionExecutor(this));
  513. getCommand("playtime").setExecutor(new PlayTimeCommand(this));
  514. getCommand("gopple").setExecutor(new GoppleCommand(this));
  515. getCommand("cobble").setExecutor(new CobbleCommand());
  516. getCommand("koth").setExecutor(new KothExecutor(this));
  517. getCommand("lives").setExecutor(new LivesExecutor(this));
  518. getCommand("logout").setExecutor(new LogoutCommand(this));
  519. getCommand("more").setExecutor(new MoreCommand());
  520. getCommand("panic").setExecutor(new PanicCommand());
  521. getCommand("staffchat").setExecutor(new StaffChatCommand());
  522. getCommand("heal").setExecutor(new HealCommand());
  523. getCommand("pay").setExecutor(new PayCommand(this));
  524. getCommand("pvptimer").setExecutor(new PvpTimerCommand(this));
  525. getCommand("LFF").setExecutor(new LFFCommand(this));
  526. getCommand("refund").setExecutor(new RefundCommand(this));
  527. getCommand("spawn").setExecutor(new SpawnCommand());
  528. getCommand("FFA").setExecutor(new FFACommand());
  529. getCommand("timer").setExecutor(new TimerExecutor(this));
  530. getCommand("kill").setExecutor(new KillCommand());
  531. getCommand("ores").setExecutor(new OreStatsCommand());
  532. getCommand("help").setExecutor(new HelpCommand());
  533. getCommand("rename").setExecutor(new RenameCommand());
  534. getCommand("teamspeak").setExecutor(new TeamspeakCommand());
  535. getCommand("coords").setExecutor(new CoordsCommand());
  536. getCommand("fsay").setExecutor(new MiscCommands());
  537. getCommand("mapkit").setExecutor(new MapKitCommand(this));
  538. getCommand("diamond").setExecutor(new DiamondReviveCommand(this));
  539. getCommand("emerald").setExecutor(new DiamondReviveCommand(this));
  540. getCommand("gold").setExecutor(new DiamondReviveCommand(this));
  541. getCommand("ruby").setExecutor(new DiamondReviveCommand(this));
  542. getCommand("staffmode").setExecutor(new StaffModeCommand());
  543. getCommand("spawner").setExecutor(new SpawnerCommand());
  544. getCommand("set").setExecutor(new SetCommand(this));
  545. getCommand("ci").setExecutor(new ClearCommand());
  546. getCommand("drop").setExecutor(new MiscCommands());
  547. getCommand("copyinv").setExecutor(new MiscCommands());
  548. getCommand("teleport").setExecutor(new TeleportCommand());
  549. getCommand("skull").setExecutor(new SkullCommand());
  550. getCommand("reset").setExecutor(new ResetCommand());
  551. getCommand("sudo").setExecutor(new SudoCommand());
  552. getCommand("whois").setExecutor(new WhoisCommand(this));
  553. getCommand("tl").setExecutor(new TLCommand());
  554. getCommand("reboot").setExecutor(new RebootCommand(plugin));
  555. getCommand("sale").setExecutor(new SaleCommand(plugin));
  556. getCommand("keysale").setExecutor(new KeySaleCommand(plugin));
  557. getCommand("wsale").setExecutor(new WeekendSaleCommand(plugin));
  558. getCommand("tkey").setExecutor(new TrippleKeyCommand(plugin));
  559. getCommand("dkey").setExecutor(new DoubleKeyCommand(plugin));
  560. getCommand("keyall").setExecutor(new KeyAllCommand(plugin));
  561. getCommand("stats").setExecutor(new StatsCommand());
  562. getCommand("glowstone").setExecutor(new GlowstoneMountain(this));
  563.  
  564. Map<String, Map<String, Object>> map = getDescription().getCommands();
  565. for (Map.Entry<String, Map<String, Object>> entry : map.entrySet()) {
  566. PluginCommand command = getCommand((String) entry.getKey());
  567. command.setPermission("command." + (String) entry.getKey());
  568. command.setPermissionMessage(ChatColor.RED.toString() + "You do not have permission to use this command.");
  569. }
  570. }
  571.  
  572. private void registerManagers() {
  573. this.claimHandler = new ClaimHandler(this);
  574. this.deathbanManager = new FlatFileDeathbanManager(this);
  575. this.economyManager = new FlatFileEconomyManager(this);
  576. this.eotwHandler = new EOTWHandler(this);
  577. this.eventScheduler = new EventScheduler(this);
  578. this.factionManager = new FlatFileFactionManager(this);
  579. this.itemDb = new SimpleItemDb(this);
  580. this.playTimeManager = new PlayTimeManager(this);
  581. this.pvpClassManager = new PvpClassManager(this);
  582. this.timerManager = new TimerManager(this);
  583. this.scoreboardHandler = new ScoreboardHandler(this);
  584. this.userManager = new UserManager(this);
  585. this.visualiseHandler = new VisualiseHandler();
  586. this.sotwTimer = new SotwTimer();
  587. this.message = new Message(this);
  588. this.signHandler = new SignHandler(this);
  589. this.reclaimManager = new ReclaimManager(this);
  590. new BardRestorer(this);
  591. }
  592.  
  593. public Message getMessage() {
  594. return this.message;
  595. }
  596.  
  597. public ItemDb getItemDb() {
  598. return this.itemDb;
  599. }
  600.  
  601. public Random getRandom() {
  602. return this.random;
  603. }
  604.  
  605. public PlayTimeManager getPlayTimeManager() {
  606. return this.playTimeManager;
  607. }
  608.  
  609. public WorldEditPlugin getWorldEdit() {
  610. return this.worldEdit;
  611. }
  612.  
  613. public ClaimHandler getClaimHandler() {
  614. return this.claimHandler;
  615. }
  616.  
  617. public SotwTimer getSotwTimer() {
  618. return this.sotwTimer;
  619. }
  620.  
  621. public SignHandler getSignHandler() {
  622. return this.signHandler;
  623. }
  624.  
  625. public ConfigurationService getConfiguration() {
  626. return this.configuration;
  627. }
  628.  
  629. public DeathbanManager getDeathbanManager() {
  630. return this.deathbanManager;
  631. }
  632.  
  633. public VanishListener getVanish() {
  634. return this.vanish;
  635. }
  636.  
  637. public EconomyManager getEconomyManager() {
  638. return this.economyManager;
  639. }
  640.  
  641. public EOTWHandler getEotwHandler() {
  642. return this.eotwHandler;
  643. }
  644.  
  645. public FactionManager getFactionManager() {
  646. return this.factionManager;
  647. }
  648.  
  649. public PvpClassManager getPvpClassManager() {
  650. return this.pvpClassManager;
  651. }
  652.  
  653. public ScoreboardHandler getScoreboardHandler() {
  654. return this.scoreboardHandler;
  655. }
  656.  
  657. public TimerManager getTimerManager() {
  658. return this.timerManager;
  659. }
  660.  
  661. public UserManager getUserManager() {
  662. return this.userManager;
  663. }
  664.  
  665. public VisualiseHandler getVisualiseHandler() {
  666. return this.visualiseHandler;
  667. }
  668.  
  669. public Base() {
  670. this.random = new Random();
  671. }
  672.  
  673. public ServerHandler getServerHandler() {
  674. return this.serverHandler;
  675. }
  676.  
  677. public static Base getPlugin() {
  678. return plugin;
  679. }
  680.  
  681. public static Base getInstance() {
  682. return instance;
  683. }
  684.  
  685. public static String getReaming(long millis) {
  686. return getRemaining(millis, true, true);
  687. }
  688.  
  689. public String getCraftBukkitVersion() {
  690. return this.craftBukkitVersion;
  691. }
  692.  
  693. public static String getRemaining(long millis, boolean milliseconds) {
  694. return getRemaining(millis, milliseconds, true);
  695. }
  696.  
  697. public static String getRemaining(long duration, boolean milliseconds, boolean trail) {
  698. if ((milliseconds) && (duration < MINUTE)) {
  699. return ((DecimalFormat) (trail ? DateTimeFormats.REMAINING_SECONDS_TRAILING
  700. : DateTimeFormats.REMAINING_SECONDS).get()).format(duration * 0.001D) + 's';
  701. }
  702. return DurationFormatUtils.formatDuration(duration, (duration >= HOUR ? "HH:" : "") + "mm:ss");
  703. }
  704.  
  705. public static File conf;
  706. public static FileConfiguration config;
  707. private String craftBukkitVersion;
  708. public static Base instance;
  709. private ConfigurationService configuration;
  710. private static final long MINUTE = TimeUnit.MINUTES.toMillis(1L);
  711. private static final long HOUR = TimeUnit.HOURS.toMillis(1L);
  712. private static Base plugin;
  713. public static Plugin pl;
  714. private ServerHandler serverHandler;
  715. public BukkitRunnable clearEntityHandler;
  716. public BukkitRunnable announcementTask;
  717. private Message message;
  718. @Getter private ReclaimManager reclaimManager;
  719.  
  720. public EventScheduler eventScheduler;
  721. public static final Joiner SPACE_JOINER = Joiner.on(' ');
  722. public static final Joiner COMMA_JOINER = Joiner.on(", ");
  723. private Random random;
  724. private PlayTimeManager playTimeManager;
  725. private WorldEditPlugin worldEdit;
  726. private ClaimHandler claimHandler;
  727. private ItemDb itemDb;
  728.  
  729. private DeathbanManager deathbanManager;
  730. private EconomyManager economyManager;
  731. private EOTWHandler eotwHandler;
  732. private FactionManager factionManager;
  733. private PvpClassManager pvpClassManager;
  734. private VanishListener vanish;
  735. private ScoreboardHandler scoreboardHandler;
  736. private SotwTimer sotwTimer;
  737. private TimerManager timerManager;
  738. private UserManager userManager;
  739. private VisualiseHandler visualiseHandler;
  740. private SignHandler signHandler;
  741.  
  742. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement