Advertisement
Guest User

Untitled

a guest
Feb 7th, 2020
36
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package de.akashi.scoreboard;
  2.  
  3. import java.util.HashMap;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.event.EventHandler;
  8. import org.bukkit.event.Listener;
  9. import org.bukkit.event.player.PlayerJoinEvent;
  10. import org.bukkit.plugin.java.JavaPlugin;
  11. import org.bukkit.scheduler.BukkitRunnable;
  12. import org.bukkit.scoreboard.DisplaySlot;
  13. import org.bukkit.scoreboard.Objective;
  14. import org.bukkit.scoreboard.Scoreboard;
  15.  
  16. public class Main extends JavaPlugin implements Listener {
  17.  
  18. private static HashMap<Scoreboard, Player> boards = new HashMap<>();
  19.  
  20. static Scoreboard sb = Bukkit.getScoreboardManager().getNewScoreboard();
  21. static Objective obj = sb.registerNewObjective("aaa", "bbb");
  22.  
  23. @Override
  24. public void onEnable() {
  25. Bukkit.getConsoleSender().sendMessage("==[SheepCraftSB]==");
  26. Bukkit.getConsoleSender().sendMessage(" ");
  27. Bukkit.getConsoleSender().sendMessage(" §aEnabled");
  28. Bukkit.getConsoleSender().sendMessage(" ");
  29. Bukkit.getConsoleSender().sendMessage("==================");
  30.  
  31. Bukkit.getPluginManager().registerEvents(this, this);
  32.  
  33.  
  34. sb.registerNewTeam("001Owner");
  35. sb.registerNewTeam("002Admin");
  36. sb.registerNewTeam("003Mod");
  37. sb.registerNewTeam("004Dev");
  38. sb.registerNewTeam("005Builder");
  39. sb.registerNewTeam("006Creator");
  40. sb.registerNewTeam("007Diamond");
  41. sb.registerNewTeam("008Gold");
  42. sb.registerNewTeam("009Silver");
  43. sb.registerNewTeam("010Spieler");
  44.  
  45. sb.getTeam("001Owner").setPrefix("§4Owner §8| §4");
  46. sb.getTeam("002Admin").setPrefix("§cAdmin §8| §c");
  47. sb.getTeam("003Mod").setPrefix("§aMod §8| §a");
  48. sb.getTeam("004Dev").setPrefix("§9Dev §8| §9");
  49. sb.getTeam("005Builder").setPrefix("§eBuilder §8| §e");
  50. sb.getTeam("006Creator").setPrefix("§dCreator §8| §d");
  51. sb.getTeam("007Diamond").setPrefix("§bDiamond §8| §b");
  52. sb.getTeam("008Gold").setPrefix("§6Gold §8| §6");
  53. sb.getTeam("009Silver").setPrefix("§fSilver §8| §f");
  54. sb.getTeam("010Spieler").setPrefix("§7Spieler §8| §7");
  55. }
  56.  
  57. @Override
  58. public void onDisable() {
  59.  
  60. }
  61.  
  62. @EventHandler
  63. public void onJoin(PlayerJoinEvent e) {
  64. new BukkitRunnable() {
  65.  
  66. @Override
  67. public void run() {
  68. setPrefix(e.getPlayer());
  69. }
  70. }.runTaskTimer(this, 0, 1);
  71. }
  72.  
  73. public static void setPrefix(Player p) {
  74. String team = "";
  75.  
  76. if(p.hasPermission("Sheep.Owner")) {
  77. team = "001Owner";
  78. }else if(p.hasPermission("Sheep.Admin")) {
  79. team = "002Admin";
  80. }else if(p.hasPermission("Sheep.Mod")) {
  81. team = "003Mod";
  82. }else if(p.hasPermission("Sheep.Dev")) {
  83. team = "004Dev";
  84. }else if(p.hasPermission("Sheep.Builder")) {
  85. team = "005Builder";
  86. }else if(p.hasPermission("Sheep.Creator")) {
  87. team = "006Creator";
  88. }else if(p.hasPermission("Sheep.Diamond")) {
  89. team = "007Diamond";
  90. }else if(p.hasPermission("Sheep.Gold")) {
  91. team = "008Gold";
  92. }else if(p.hasPermission("Sheep.Silver")) {
  93. team = "009Silver";
  94. }else if(p.hasPermission("Sheep.Player")) {
  95. team = "010Spieler";
  96. }
  97.  
  98. String rank = "";
  99.  
  100. if(p.hasPermission("Sheep.Owner")) {
  101. rank = "§4Owner ";
  102. }else if(p.hasPermission("Sheep.Admin")) {
  103. rank = "§cAdmin ";
  104. }else if(p.hasPermission("Sheep.Mod")) {
  105. rank = "§aMod";
  106. }else if(p.hasPermission("Sheep.Dev")) {
  107. rank = "§9Dev";
  108. }else if(p.hasPermission("Sheep.Builder")) {
  109. rank = "§eBuilder";
  110. }else if(p.hasPermission("Sheep.Creator")) {
  111. rank = "§dCreator";
  112. }else if(p.hasPermission("Sheep.Diamond")) {
  113. rank = "§bDiamond";
  114. }else if(p.hasPermission("Sheep.Gold")) {
  115. rank = "§6Gold";
  116. }else if(p.hasPermission("Sheep.Silver")) {
  117. rank = "§fSilver";
  118. }else if(p.hasPermission("Sheep.Player")) {
  119. rank = "§7Player";
  120. }
  121.  
  122. sb.getTeam(team).addPlayer(p);
  123. p.setDisplayName(sb.getTeam(team).getPrefix() + p.getDisplayName());
  124. obj.setDisplaySlot(DisplaySlot.SIDEBAR);
  125. obj.setDisplayName("§a\u00bb §fSheep§aCraft§f.de §a\u00ab");
  126.  
  127. obj.getScore(" ").setScore(6);
  128. obj.getScore("§l\u2022§r§7Dein Rang").setScore(5);
  129. obj.getScore("§l\u2937§r" + rank).setScore(4);
  130. obj.getScore("lullll").setScore(3);
  131. obj.getScore("lulll").setScore(2);
  132. obj.getScore("lull").setScore(1);
  133. obj.getScore("lul").setScore(0);
  134. boards.put(sb, p);
  135.  
  136. for(Player all : Bukkit.getOnlinePlayers()) {
  137. all.setScoreboard(sb);
  138. }
  139. }
  140.  
  141. }
Advertisement
RAW Paste Data Copied
Advertisement