Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. public class Main extends JavaPlugin {
  2.  
  3. public static final String prefix = "§8[§cKnockIT§8]";
  4. public static Main plugin;
  5. public static MySQL mysql;
  6. private Coins coins;
  7.  
  8.  
  9.  
  10. @Override
  11. public void onEnable() {
  12. init(Bukkit.getPluginManager());
  13.  
  14. if(!getDataFolder().exists()){
  15. getDataFolder().mkdir();
  16. }
  17.  
  18. if(!new File(getDataFolder() ,"config.yml").exists()){
  19. try {
  20. new File(getDataFolder() ,"config.yml").createNewFile();
  21. } catch (IOException e) {
  22. e.printStackTrace();
  23. }
  24. }
  25. coins = new Coins();
  26. this.getCommand("setspawn").setExecutor(new SetDatas());
  27. this.getCommand("setpvp").setExecutor(new SetDatas());
  28. this.getCommand("setdeath").setExecutor(new SetDatas());
  29. this.getCommand("stats").setExecutor(new StatsCommand());
  30. Bukkit.broadcastMessage(prefix + "§a Das Plugin wurde geladen.");
  31. updateScoreboard();
  32.  
  33. }
  34.  
  35. @Override
  36. public void onDisable() {
  37.  
  38. Bukkit.broadcastMessage(prefix + "§c Plugin wurde gestoppt");
  39.  
  40. }
  41.  
  42.  
  43.  
  44.  
  45. public void init(PluginManager pluginManager){
  46. pluginManager.registerEvents(new Prevent(), this);
  47. pluginManager.registerEvents(new PlayerConnectionListeners(this),this);
  48. pluginManager.registerEvents(new MoveListener(this),this);
  49. pluginManager.registerEvents(new Death(),this);
  50. pluginManager.registerEvents( new PlayerHitOtherEvent(),this);
  51. pluginManager.registerEvents(new PlayerRespawnListener(), this);
  52. pluginManager.registerEvents(new Shop(), this);
  53. pluginManager.registerEvents(new Chatutils(), this);
  54. PlayerHitOtherEvent.hits = new HashMap<>();
  55.  
  56.  
  57.  
  58. // getCommand("setspawn").setExecutor(new SetDatas());
  59. // getCommand("setdeath").setExecutor(new SetDatas());
  60. // getCommand("setpvp").setExecutor(new SetDatas());
  61.  
  62.  
  63. }
  64. public Location getSpawn(){
  65.  
  66. double x = getConfig().getDouble("spawn.x");
  67. double y = getConfig().getDouble("spawn.y");
  68. double z = getConfig().getDouble("spawn.z");
  69.  
  70. float yaw = (float) getConfig().getDouble("spawn.yaw");
  71. float pitch = (float) getConfig().getDouble("spawn.pitch");
  72.  
  73. String worldname = getConfig().getString("spawn.world");
  74.  
  75. return new Location(Bukkit.getWorld(worldname),x,y,z,yaw,pitch);
  76. }
  77. public static Main getInstance(){
  78. return plugin;
  79. }
  80. public static MySQL getMysql() {
  81. return mysql;
  82. }
  83. public void updateScoreboard() {
  84. Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
  85.  
  86. @Override
  87. public void run() {
  88. for(Player players: Bukkit.getOnlinePlayers()) {
  89.  
  90. new ScoreboardHandler().setScoreboard(players);
  91.  
  92. }
  93. }
  94. }, 0, 20);
  95.  
  96.  
  97. }
  98. public Coins getCoins() {
  99. return coins;
  100. }
  101.  
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement