diff --git a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java index bb82126..5fccaa0 100644 --- a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java +++ b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java @@ -18,11 +18,11 @@ public class SWScoreboard { ScoreboardCallback callback; - public SWScoreboard(Player player, ScoreboardCallback callback) { + public SWScoreboard(ScoreboardCallback callback) { this.callback = callback; } - public void sendScoreboard(Player player) { + private void sendScoreboard(Player player) { PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); remove.getStrings().write(0, "AAA"); remove.getBytes().write(0, (byte) 1); @@ -56,7 +56,7 @@ public class SWScoreboard { } - public void display(Player player) { + private void display(Player player) { PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE); display.getBytes().write(0, (byte) 1); display.getStrings().write(0, this.callback.getTitle()); @@ -69,28 +69,17 @@ public class SWScoreboard { } public static void startPlayerBoards() { - Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getInstance(), new Runnable() { - @Override - public void run() { - synchronized (playerBoards) { - for(Map.Entry entry : playerBoards.entrySet()) { - entry.getValue().sendScoreboard(entry.getKey()); - entry.getValue().display(entry.getKey()); - } + Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getInstance(), () -> { + synchronized (playerBoards) { + for(Map.Entry entry : playerBoards.entrySet()) { + entry.getValue().sendScoreboard(entry.getKey()); + entry.getValue().display(entry.getKey()); } } }, 10, 5); } - public ScoreboardCallback getCallback() { - return callback; - } - - public void setCallback(ScoreboardCallback callback) { - this.callback = callback; - } - public static HashMap getPlayerBoards() { return playerBoards; }