Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.51 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileNotFoundException;
  3. import java.io.IOException;
  4. import java.sql.PreparedStatement;
  5. import java.sql.SQLException;
  6. import java.util.ArrayList;
  7.  
  8. import org.bukkit.Bukkit;
  9. import org.bukkit.command.ConsoleCommandSender;
  10. import org.bukkit.configuration.InvalidConfigurationException;
  11. import org.bukkit.configuration.file.YamlConfiguration;
  12. import org.bukkit.plugin.java.JavaPlugin;
  13.  
  14. import de.devfeuer.skypvp.Utis.MySQL;
  15. import de.devfeuer.skypvp.Utis.user;
  16. import de.devfeuer.skypvp.command.command_ChatClear;
  17. import de.devfeuer.skypvp.command.command_Clan;
  18. import de.devfeuer.skypvp.command.command_Clear;
  19. import de.devfeuer.skypvp.command.command_Gamemode;
  20. import de.devfeuer.skypvp.command.command_GiveAll;
  21. import de.devfeuer.skypvp.command.command_GlobalMute;
  22. import de.devfeuer.skypvp.command.command_Hub;
  23. import de.devfeuer.skypvp.command.command_Kick;
  24. import de.devfeuer.skypvp.command.command_ME;
  25. import de.devfeuer.skypvp.command.command_MSG;
  26. import de.devfeuer.skypvp.command.command_Reload;
  27. import de.devfeuer.skypvp.command.command_Rename;
  28. import de.devfeuer.skypvp.command.command_Repair;
  29. import de.devfeuer.skypvp.command.command_Report;
  30. import de.devfeuer.skypvp.command.command_SetSpawn;
  31. import de.devfeuer.skypvp.command.command_Spawn;
  32. import de.devfeuer.skypvp.command.command_Spenden;
  33. import de.devfeuer.skypvp.command.command_Stack;
  34. import de.devfeuer.skypvp.command.command_Support;
  35. import de.devfeuer.skypvp.command.command_Team;
  36. import de.devfeuer.skypvp.command.command_TeamChat;
  37. import de.devfeuer.skypvp.command.command_Test;
  38. import de.devfeuer.skypvp.command.command_TpAll;
  39. import de.devfeuer.skypvp.command.command_Umfrage;
  40. import de.devfeuer.skypvp.command.command_Warp;
  41. import de.devfeuer.skypvp.command.command_XP;
  42. import de.devfeuer.skypvp.command.command_ban;
  43. import de.devfeuer.skypvp.command.command_delwarp;
  44. import de.devfeuer.skypvp.command.command_fly;
  45. import de.devfeuer.skypvp.command.command_home;
  46. import de.devfeuer.skypvp.command.command_kopf;
  47. import de.devfeuer.skypvp.command.command_list;
  48. import de.devfeuer.skypvp.command.command_money;
  49. import de.devfeuer.skypvp.command.command_mute;
  50. import de.devfeuer.skypvp.command.command_ping;
  51. import de.devfeuer.skypvp.command.command_rang;
  52. import de.devfeuer.skypvp.command.command_setHome;
  53. import de.devfeuer.skypvp.command.command_setHub;
  54. import de.devfeuer.skypvp.command.command_setShop;
  55. import de.devfeuer.skypvp.command.command_setwarp;
  56. import de.devfeuer.skypvp.command.command_stats;
  57. import de.devfeuer.skypvp.command.command_tempBan;
  58. import de.devfeuer.skypvp.command.command_tp;
  59. import de.devfeuer.skypvp.command.command_ts;
  60. import de.devfeuer.skypvp.command.command_unBan;
  61. import de.devfeuer.skypvp.command.command_vote;
  62. import de.devfeuer.skypvp.command.command_warps;
  63. import de.devfeuer.skypvp.events.event_FreeSchilder;
  64. import de.devfeuer.skypvp.events.event_Join;
  65. import de.devfeuer.skypvp.events.event_Tod;
  66. import de.devfeuer.skypvp.events.event_chat;
  67. import de.devfeuer.skypvp.events.event_mute;
  68. import de.devfeuer.skypvp.events.event_tausch;
  69. import de.devfeuer.skypvp.events.event_vote;
  70. import de.devfeuer.skypvp.shop.Shop_NoDamage;
  71.  
  72. public class main extends JavaPlugin {
  73.  
  74. public static ConsoleCommandSender console = Bukkit.getConsoleSender();
  75.  
  76. @Override
  77. public void onEnable() {
  78. registerclass();
  79. console.sendMessage("§a[§3Sky§7-§6PvP§a] §bIst nun §aOnline§b. §3System by §cDasGunter");
  80. user.GlobalMute = false;
  81. command_XP.xps = false;
  82. auto();
  83. clearlag();
  84. userrangcfg();
  85. // Commands
  86. this.getCommand("spawn").setExecutor(new command_Spawn(this));
  87. this.getCommand("fix").setExecutor(new command_Repair());
  88. this.getCommand("TempBan").setExecutor(new command_tempBan());
  89. this.getCommand("me").setExecutor(new command_ME());
  90. this.getCommand("money").setExecutor(new command_money());
  91. this.getCommand("ping").setExecutor(new command_ping());
  92. this.getCommand("ja").setExecutor(new command_Umfrage(this));
  93. this.getCommand("nein").setExecutor(new command_Umfrage(this));
  94. this.getCommand("umfrage").setExecutor(new command_Umfrage(this));
  95. this.getCommand("tp").setExecutor(new command_tp());
  96. this.getCommand("kopf").setExecutor(new command_kopf());
  97. this.getCommand("report").setExecutor(new command_Report());
  98. this.getCommand("clear").setExecutor(new command_Clear());
  99. this.getCommand("tp").setExecutor(new command_tp());
  100. this.getCommand("setShop").setExecutor(new command_setShop());
  101. this.getCommand("list").setExecutor(new command_list());
  102. this.getCommand("ts").setExecutor(new command_ts());
  103. this.getCommand("Team").setExecutor(new command_Team());
  104. this.getCommand("rl").setExecutor(new command_Reload());
  105. this.getCommand("reload").setExecutor(new command_Reload());
  106. this.getCommand("spenden").setExecutor(new command_Spenden());
  107. this.getCommand("delwarp").setExecutor(new command_delwarp());
  108. this.getCommand("setwarp").setExecutor(new command_setwarp());
  109. this.getCommand("warp").setExecutor(new command_Warp(this));
  110. this.getCommand("warps").setExecutor(new command_warps());
  111. this.getCommand("stack").setExecutor(new command_Stack());
  112. this.getCommand("msg").setExecutor(new command_MSG());
  113. this.getCommand("tell").setExecutor(new command_MSG());
  114. this.getCommand("gl").setExecutor(new command_GlobalMute());
  115. this.getCommand("rename").setExecutor(new command_Rename());
  116. this.getCommand("fly").setExecutor(new command_fly());
  117. this.getCommand("gamemode").setExecutor(new command_Gamemode());
  118. this.getCommand("gm").setExecutor(new command_Gamemode());
  119. this.getCommand("setspawn").setExecutor(new command_SetSpawn());
  120. this.getCommand("cc").setExecutor(new command_ChatClear());
  121. this.getCommand("kick").setExecutor(new command_Kick());
  122. this.getCommand("giveall").setExecutor(new command_GiveAll());
  123. this.getCommand("clan").setExecutor(new command_Clan());
  124. this.getCommand("stats").setExecutor(new command_stats());
  125. this.getCommand("tpall").setExecutor(new command_TpAll());
  126. this.getCommand("sethome").setExecutor(new command_setHome());
  127. this.getCommand("test").setExecutor(new command_Test());
  128. this.getCommand("TC").setExecutor(new command_TeamChat());
  129. this.getCommand("vote").setExecutor(new command_vote());
  130. this.getCommand("rang").setExecutor(new command_rang());
  131. this.getCommand("xp").setExecutor(new command_XP(this));
  132. this.getCommand("hub").setExecutor(new command_Hub(this));
  133. this.getCommand("sethub").setExecutor(new command_setHub());
  134. this.getCommand("ban").setExecutor(new command_ban());
  135. this.getCommand("unban").setExecutor(new command_unBan());
  136. this.getCommand("mute").setExecutor(new command_mute());
  137. this.getCommand("support").setExecutor(new command_Support(this));
  138. this.getCommand("home").setExecutor(new command_home(this));
  139. loadBan();
  140.  
  141. MySQL.connect();
  142. MySQL.update("CREATE TABLE IF NOT EXISTS Stats(Spieler VARCHAR(100), Tokens INT, kills INT, tode INT);");
  143. }
  144.  
  145. @Override
  146. public void onDisable() {
  147. MySQL.disconnect();
  148. }
  149. public static ConsoleCommandSender getConsole() {
  150. return console;
  151. }
  152.  
  153. private void loadBan(){
  154. File file = new File("plugins/SkyPvP/ban.yml");
  155. YamlConfiguration cfg = new YamlConfiguration().loadConfiguration(file);
  156. if(!file.exists()){
  157. try {
  158. cfg.save(file);
  159. file.createNewFile();
  160. cfg.set("Ban.list", new ArrayList<>());
  161. } catch (IOException e) {}
  162. }
  163. }
  164. private void registerclass(){
  165. Bukkit.getPluginManager().registerEvents(new event_FreeSchilder(), this);
  166. Bukkit.getPluginManager().registerEvents(new event_Join(), this);
  167. Bukkit.getPluginManager().registerEvents(new event_Tod(), this);
  168. Bukkit.getPluginManager().registerEvents(new event_mute(), this);
  169. Bukkit.getPluginManager().registerEvents(new command_tempBan(), this);
  170. Bukkit.getPluginManager().registerEvents(new event_chat(this), this);
  171. Bukkit.getPluginManager().registerEvents(new event_tausch(), this);
  172. Bukkit.getPluginManager().registerEvents(new command_GlobalMute(), this);
  173. Bukkit.getPluginManager().registerEvents(new Shop_NoDamage(), this);
  174. Bukkit.getPluginManager().registerEvents(new event_vote(), this);
  175. Bukkit.getPluginManager().registerEvents(new command_Support(this), this);
  176. }
  177.  
  178. private void userrangcfg(){
  179. File f = new File("plugins/SkyPvP/rang.yml");
  180. YamlConfiguration cfg = new YamlConfiguration().loadConfiguration(f);
  181. if(!f.exists()){
  182. try {
  183. f.createNewFile();
  184. cfg.save(f);
  185. } catch (IOException e) {}
  186. }else{
  187. cfg = YamlConfiguration.loadConfiguration(f);
  188. }
  189. }
  190. private String msg = user.prefix+"Unser Server ist in der beta.";
  191. private String msg1 = user.prefix+"Du willst einen Clan ? §3/clan";
  192. private String msg2 = user.prefix+"Du willst bessere respawn items ? §3/warp kit";
  193. private String msg3 = user.prefix+"Du willst verzaubern ? /warp verzaubern";
  194. private String msg4 = user.prefix+"Du hast einen Hacker gefunden ? §3/report <name> <grund>";
  195. private String msg5 = user.prefix+"Du willst Spenden ? §3/spenden";
  196.  
  197. public static int msgnr = 1;
  198. private void auto(){
  199. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable()
  200. {
  201. public void run()
  202. {
  203. switch (msgnr)
  204. {
  205. case 1:
  206. Bukkit.broadcastMessage(msg1);
  207. break;
  208. case 2:
  209. Bukkit.broadcastMessage(msg2);
  210. break;
  211. case 3:
  212. Bukkit.broadcastMessage(msg3);
  213. break;
  214. case 4:
  215. Bukkit.broadcastMessage(msg4);
  216. break;
  217. case 5:
  218. Bukkit.broadcastMessage(msg5);
  219. break;
  220. default:
  221. Bukkit.broadcastMessage(msg1);msgnr = 1;
  222. }
  223. msgnr += 1;
  224. }
  225. }, 300*20, 300*20);
  226. }
  227.  
  228. private void clearlag(){
  229.  
  230. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable()
  231. {
  232. public void run()
  233. {
  234. Bukkit.getServer().broadcastMessage(user.prefix+"Die Items auf den Boden wurden Entfernt.");
  235. Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "/remove items -1");
  236. Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "remove items -1");
  237. }
  238. }, 300*20, 300*20);
  239. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable()
  240. {
  241. public void run()
  242. {
  243. Bukkit.getServer().broadcastMessage(user.prefix+"Die Items werden in §31§b Minute auf den Boden Entfernt.");
  244. }
  245. }, 240*20, 240*20);
  246.  
  247. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable()
  248. {
  249. public void run()
  250. {
  251. Bukkit.getServer().broadcastMessage(user.prefix+"§3Du willst eine Clan base oder ein zuhause in einer pvp welt ? mach doch /warp pvp");
  252. }
  253. }, 120*20, 120*20);
  254.  
  255. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable()
  256. {
  257. public void run()
  258. {
  259. Bukkit.getServer().broadcastMessage(user.prefix+"§3Du willst fly und tolle Items mache /vote und vote für uns.");
  260. }
  261. }, 70*20, 70*20);
  262. }
  263.  
  264.  
  265.  
  266. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement