Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.87 KB | None | 0 0
  1. package de.tempoo50.system.main;
  2.  
  3. import java.util.HashMap;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.plugin.PluginManager;
  8. import org.bukkit.plugin.java.JavaPlugin;
  9.  
  10. import de.tempoo50.system.commands.*;
  11. import de.tempoo50.system.data.Data;
  12. import de.tempoo50.system.data.FileManager;
  13. import de.tempoo50.system.files.*;
  14. import de.tempoo50.system.listener.*;
  15. import de.tempoo50.system.mysql.MySQLKopf;
  16. import de.tempoo50.system.utils.*;
  17.  
  18. public class ServerSystem extends JavaPlugin {
  19.  
  20. public static final String PREFIX = "§7[§cServerSystem§7] §r";
  21.  
  22. private static ServerSystem plugin;
  23.  
  24. public static HashMap<Player, KopfPlayer> players = new HashMap<>();
  25.  
  26. private static ServerSystem inctance;
  27.  
  28. public void onEnable() {
  29.  
  30. inctance = this;
  31.  
  32. new Broadcaster(this).startBroadcast();
  33. new RecipeLoader().registerRecipes();
  34.  
  35. try {
  36. loadFile();
  37. loadCommands();
  38. loadListener(Bukkit.getPluginManager());
  39. if(Data.useMySQL){
  40. loadMySQL();
  41. Bukkit.getOnlinePlayers().forEach(p -> p.kickPlayer("§cServer reload!"));
  42. }
  43. }catch (Exception e1){
  44. e1.printStackTrace();
  45. log("§4Fehler: §cPlugin konnte nicht geladen werden.");
  46. Bukkit.getPluginManager().disablePlugin(this);
  47. return;
  48. }finally{
  49. log("§aPlugin geladen.");
  50. log("§agecodet von Tempoo50.");
  51. }
  52. }
  53.  
  54. @Override
  55. public void onDisable() {
  56. log("§cPlugin entladen.");
  57. }
  58.  
  59. private void loadCommands(){
  60. getCommand("kopf").setExecutor(new KopfCommand());
  61. getCommand("sign").setExecutor(new SignCommand());
  62. getCommand("cc").setExecutor(new ChatclearCommand());
  63. getCommand("clear").setExecutor(new ClearCommand());
  64. getCommand("craft").setExecutor(new CraftCommand());
  65. getCommand("gm0").setExecutor(new GmSurvivalCommand());
  66. getCommand("gm1").setExecutor(new GmCreativCommand());
  67. getCommand("gm2").setExecutor(new GmAdventureCommand());
  68. getCommand("gm3").setExecutor(new GmSpectatorCommand());
  69. getCommand("heal").setExecutor(new HealCommand());
  70. getCommand("save").setExecutor(new SaveCommand());
  71. getCommand("load").setExecutor(new LoadCommand());
  72. getCommand("SetSpawn").setExecutor(new SetSpawn());
  73. getCommand("Spawn").setExecutor(new SpawnCommand());
  74. getCommand("setsupport").setExecutor(new SetSupport());
  75. getCommand("support").setExecutor(new Support());
  76. getCommand("v").setExecutor(new VanishCommand());
  77. getCommand("kill").setExecutor(new KillCommand());
  78. getCommand("day").setExecutor(new DayCommand());
  79. getCommand("night").setExecutor(new NightCommand());
  80. getCommand("fly").setExecutor(new FlyCommand());
  81. getCommand("bewerbung").setExecutor(new BewerbungCommand(this));
  82. getCommand("discord").setExecutor(new DiscordCommand());
  83. getCommand("ts").setExecutor(new TSCommand());
  84. getCommand("web").setExecutor(new WebCommand());
  85. getCommand("forum").setExecutor(new ForumCommand());
  86. getCommand("twitter").setExecutor(new TwitterCommand());
  87. getCommand("shop").setExecutor(new ShopCommand());
  88. getCommand("yt").setExecutor(new YTCommand());
  89. getCommand("insta").setExecutor(new InstaCommand());
  90.  
  91. }
  92.  
  93. private void loadListener(PluginManager pm){
  94. pm.registerEvents(new KopfJoinListener(),this);
  95. pm.registerEvents(new JoinListener(), this);
  96. pm.registerEvents(new DeathListener(), this);
  97. pm.registerEvents(new QuitListener(), this);
  98. pm.registerEvents(new RespawnListener(), this);
  99. pm.registerEvents(new VanishJoinListener(), this);
  100. pm.registerEvents(new VanishQuitListener(), this);
  101. pm.registerEvents(new ChatListener(), this);
  102. pm.registerEvents(new BlacklistListener(), this);
  103. }
  104.  
  105. private void loadFile(){
  106. FileManager.loadFile();
  107. FileManager.readFile();
  108. BewerbungsFile.loadBewerbung();
  109. ServerLinksFile.loadServerLinks();
  110. SpawnFile.loadSpawn();
  111. ChatSystemFile.loadChatSystem();
  112. BlacklistFile.loadBlacklist();
  113. BewerbungsFileGer.loadBewerbungGer();
  114. ServerLinksFileGer.loadServerLinksGer();
  115. SpawnFileGer.loadSpawnGer();
  116. ChatSystemFileGer.loadChatSystemGer();
  117. BlacklistFileGer.loadBlacklistGer();
  118. }
  119.  
  120. private void loadMySQL(){
  121. MySQLKopf.connect();
  122. MySQLKopf.update("CREATE TABLE IF NOT EXISTS Kopf (UUID VARCHAR(255),Time LONG)");
  123. }
  124.  
  125. public static void log(String msg){
  126. Bukkit.getConsoleSender().sendMessage(PREFIX + msg);
  127. }
  128.  
  129. public static void logs(final String message){
  130. Bukkit.getConsoleSender().sendMessage(PREFIX + message);
  131. }
  132.  
  133. public static ServerSystem getPlugin() {
  134. return plugin;
  135. }
  136.  
  137. public static ServerSystem getInctance(){
  138. return inctance;
  139. }
  140.  
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement