Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 KB | None | 0 0
  1. package com.ACStache.ArenaGodPlus;
  2.  
  3. import java.io.File;
  4. import java.util.logging.Logger;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.ChatColor;
  8. import org.bukkit.World;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.plugin.PluginDescriptionFile;
  11. import org.bukkit.plugin.PluginManager;
  12. import org.bukkit.plugin.java.JavaPlugin;
  13.  
  14. import com.ACStache.ArenaGodPlus.PluginListeners.HeroesListener;
  15. import com.ACStache.ArenaGodPlus.PluginListeners.MobArenaListener;
  16. import com.ACStache.ArenaGodPlus.PluginListeners.MobDungeonListener;
  17. import com.ACStache.ArenaGodPlus.PluginListeners.PvPArenaListener;
  18. import com.ACStache.ArenaGodPlus.PluginListeners.WarListener;
  19. import com.garbagemule.MobArena.framework.ArenaMaster;
  20.  
  21. import com.garbagemule.MobArena.MobArena;
  22. import com.herocraftonline.heroes.Heroes;
  23. import net.slipcor.pvparena.PVPArena;
  24. import com.tommytony.war.War;
  25. import de.kumpelblase2.mobdungeon.MobDungeonMain;
  26.  
  27. public class ArenaGodPlus extends JavaPlugin
  28. {
  29. private static Logger log = Logger.getLogger("Minecraft");
  30. private static PluginDescriptionFile info;
  31. private static AGPCommandExecutor agpExecutor;
  32. private static File dir, file;
  33. public static ArenaMaster am;
  34. private static boolean foundMA = false, foundPVP = false, foundWar = false, foundMD = false;
  35.  
  36. public void onEnable()
  37. {
  38. info = getDescription();
  39.  
  40. agpExecutor = new AGPCommandExecutor(this);
  41. getCommand("god").setExecutor(agpExecutor);
  42. getCommand("agp").setExecutor(agpExecutor);
  43.  
  44. dir = getDataFolder();
  45. file = new File(dir, "config.yml");
  46. if(!dir.exists()) {
  47. dir.mkdir();
  48. AGPConfig.loadConfig(file);
  49. }
  50. else {
  51. AGPConfig.loadConfig(file);
  52. }
  53.  
  54. for(World w : Bukkit.getWorlds())
  55. for(Player p : w.getPlayers())
  56. if(AGPConfig.getPersGod(p))
  57. AGPSetter.addGod(p);
  58.  
  59. setupListeners();
  60. printToConsole("v" + info.getVersion() + " Successfully Enabled! By: " + info.getAuthors(), false);
  61. }
  62.  
  63. public void onDisable()
  64. {
  65. printToConsole("Sucessfully Disabled", false);
  66. }
  67.  
  68. private void setupListeners()
  69. {
  70. PluginManager pm = this.getServer().getPluginManager();
  71. Heroes heroPlugin = (Heroes)pm.getPlugin("Heroes");
  72. MobArena maPlugin = (MobArena)pm.getPlugin("MobArena");
  73. PVPArena pvpPlugin = (PVPArena)pm.getPlugin("pvparena");
  74. MobDungeonMain mdPlugin = (MobDungeonMain)pm.getPlugin("MobDungeon");
  75. War warPlugin = (War)pm.getPlugin("War");
  76.  
  77. pm.registerEvents(new AGPListener(), this);
  78.  
  79. if(heroPlugin != null && heroPlugin.isEnabled()) {
  80. pm.registerEvents(new HeroesListener(), this);
  81. printToConsole("Found Heroes!", false);
  82. }
  83. if(maPlugin != null && maPlugin.isEnabled()) {
  84. am = maPlugin.getArenaMaster();
  85. pm.registerEvents(new MobArenaListener(this), this);
  86. foundMA = true;
  87. printToConsole("Found Mob Arena!", false);
  88. }
  89. if(pvpPlugin != null && pvpPlugin.isEnabled()) {
  90. pm.registerEvents(new PvPArenaListener(this), this);
  91. foundPVP = true;
  92. printToConsole("Found PvP Arena!", false);
  93. }
  94. if(warPlugin != null && warPlugin.isEnabled()) {
  95. pm.registerEvents(new WarListener(), this);
  96. foundWar = true;
  97. printToConsole("Found War!", false);
  98. }
  99. if(mdPlugin != null && mdPlugin.isEnabled()) {
  100. pm.registerEvents(new MobDungeonListener(this), this);
  101. foundMD = true;
  102. printToConsole("Found Mob Dungeon!", false);
  103. }
  104. }
  105.  
  106. public static void printToConsole(String msg, boolean warn)
  107. {
  108. if(warn)
  109. log.warning("[" + info.getName() + "] " + msg);
  110. else
  111. log.info("[" + info.getName() + "] " + msg);
  112. }
  113. public static void printToPlayer(Player p, String msg, boolean warn)
  114. {
  115. String color = "";
  116. if(warn)
  117. color += ChatColor.RED + "";
  118. else
  119. color += ChatColor.AQUA + "";
  120. color += "[ArenaGodPlus]";
  121. p.sendMessage(color + ChatColor.WHITE + msg);
  122. }
  123.  
  124. public static boolean foundMA()
  125. {
  126. return foundMA;
  127. }
  128. public static boolean foundPVP()
  129. {
  130. return foundPVP;
  131. }
  132. public static boolean foundWar()
  133. {
  134. return foundWar;
  135. }
  136. public static boolean foundMD()
  137. {
  138. return foundMD;
  139. }
  140. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement