From 9418df66fe5531dc7350edcb46240b13f0c1d8a2 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 24 Nov 2019 00:21:12 +0100 Subject: [PATCH 01/22] added scoreboard without complete multiversion support --- SpigotCore_12/SpigotCore_12.iml | 15 ++++ SpigotCore_14/SpigotCore_14.iml | 15 ++++ SpigotCore_8/SpigotCore_8.iml | 15 ++++ SpigotCore_Main/SpigotCore_Main.iml | 18 ++++ .../de/steamwar/scoreboard/SWScoreboard.java | 89 +++++++++++++++++++ .../scoreboard/ScoreboardCallback.java | 12 +++ .../scoreboard/ScoreboardContainer.java | 57 ++++++++++++ pom.xml | 9 ++ 8 files changed, 230 insertions(+) create mode 100644 SpigotCore_12/SpigotCore_12.iml create mode 100644 SpigotCore_14/SpigotCore_14.iml create mode 100644 SpigotCore_8/SpigotCore_8.iml create mode 100644 SpigotCore_Main/SpigotCore_Main.iml create mode 100644 SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java create mode 100644 SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardCallback.java create mode 100644 SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardContainer.java diff --git a/SpigotCore_12/SpigotCore_12.iml b/SpigotCore_12/SpigotCore_12.iml new file mode 100644 index 0000000..435bce5 --- /dev/null +++ b/SpigotCore_12/SpigotCore_12.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SpigotCore_14/SpigotCore_14.iml b/SpigotCore_14/SpigotCore_14.iml new file mode 100644 index 0000000..e977297 --- /dev/null +++ b/SpigotCore_14/SpigotCore_14.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SpigotCore_8/SpigotCore_8.iml b/SpigotCore_8/SpigotCore_8.iml new file mode 100644 index 0000000..9c3822a --- /dev/null +++ b/SpigotCore_8/SpigotCore_8.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SpigotCore_Main/SpigotCore_Main.iml b/SpigotCore_Main/SpigotCore_Main.iml new file mode 100644 index 0000000..71dcca5 --- /dev/null +++ b/SpigotCore_Main/SpigotCore_Main.iml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java new file mode 100644 index 0000000..ac95ad1 --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java @@ -0,0 +1,89 @@ +package de.steamwar.scoreboard; + +import com.comphenix.protocol.PacketType; +import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.events.PacketContainer; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; + +public class SWScoreboard { + + HashMap data; + private Player player; + private String title; + + public SWScoreboard(Player player, HashMap data, String title) { + this.data = data; + this.player = player; + this.title = title; + } + + public void sendScoreboard() { + PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); + remove.getStrings().write(0, "AAA"); + remove.getBytes().write(0, (byte) 1); + + PacketContainer createpacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); + createpacket.getStrings().write(0, "AAA"); + createpacket.getBytes().write(0, (byte) 0); + createpacket.getStrings().write(1, this.title); + createpacket.getIntegers().write(0, 0); + + try { + ProtocolLibrary.getProtocolManager().sendServerPacket(player, remove); + ProtocolLibrary.getProtocolManager().sendServerPacket(player, createpacket); + } catch (InvocationTargetException ex) { + Bukkit.getLogger().log(Level.SEVERE, "COULD NOT SEND PACKAGE", ex); + } + + for(Map.Entry entry : data.entrySet()) { + PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE); + update.getStrings().write(0, entry.getKey()); + update.getBytes().write(0, (byte) 0); + update.getStrings().write(1, "AAA"); + update.getIntegers().write(0, entry.getValue()); + + try { + ProtocolLibrary.getProtocolManager().sendServerPacket(player, update); + } catch (InvocationTargetException ex) { + Bukkit.getLogger().log(Level.SEVERE, "COULD NOT SEND PACKAGE", ex); + } + } + + } + + public void display() { + PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE); + display.getBytes().write(0, (byte) 1); + display.getStrings().write(0, this.title); + } + + public HashMap getData() { + return data; + } + + public void setData(HashMap data) { + this.data = data; + } + + public Player getPlayer() { + return player; + } + + public void setPlayer(Player player) { + this.player = player; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } +} diff --git a/SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardCallback.java b/SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardCallback.java new file mode 100644 index 0000000..44ad47b --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardCallback.java @@ -0,0 +1,12 @@ +package de.steamwar.scoreboard; + +import java.util.HashMap; + +public interface ScoreboardCallback { + + public HashMap getData(); + + public String getTitle(); + + +} diff --git a/SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardContainer.java b/SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardContainer.java new file mode 100644 index 0000000..8389c22 --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardContainer.java @@ -0,0 +1,57 @@ +package de.steamwar.scoreboard; + +import de.steamwar.core.Core; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import java.util.HashMap; +import java.util.UUID; + +public class ScoreboardContainer { + + private static HashMap containers = new HashMap<>(); + + Player player; + ScoreboardCallback callback; + + public ScoreboardContainer(Player player, ScoreboardCallback callback) { + this.player = player; + this.callback = callback; + } + + public void update() { + + //Update + SWScoreboard update = new SWScoreboard(player, callback.getData(), callback.getTitle()); + update.sendScoreboard(); + Bukkit.getScheduler().runTaskLater(Core.getInstance(), new Runnable() { + @Override + public void run() { + update.display(); + } + }, 2); + } + + public void startScoreboard() { + Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getInstance(), new Runnable() { + @Override + public void run() { + for(ScoreboardContainer container : ScoreboardContainer.getContainers().values()) { + container.update(); + } + } + }, 10, 5); + } + + public Player getPlayer() { + return player; + } + + public void setPlayer(Player player) { + this.player = player; + } + + public static HashMap getContainers() { + return containers; + } +} diff --git a/pom.xml b/pom.xml index dbc56a3..5d1491f 100644 --- a/pom.xml +++ b/pom.xml @@ -42,4 +42,13 @@ SpigotCore_14 SpigotCore_Main + + + + steamwar + ProtocolLib + 1.0 + provided + + \ No newline at end of file -- 2.39.2 From f4cb5b14c08d098d672f27c103d0420d119dc525 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 24 Nov 2019 00:22:59 +0100 Subject: [PATCH 02/22] hotfix --- .../src/de/steamwar/scoreboard/SWScoreboard.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java index ac95ad1..d71e169 100644 --- a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java +++ b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java @@ -61,6 +61,12 @@ public class SWScoreboard { PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE); display.getBytes().write(0, (byte) 1); display.getStrings().write(0, this.title); + + try { + ProtocolLibrary.getProtocolManager().sendServerPacket(player, display); + } catch (InvocationTargetException ex) { + Bukkit.getLogger().log(Level.SEVERE, "COULD NOT SEND PACKAGE", ex); + } } public HashMap getData() { -- 2.39.2 From f0586516aa90a78b91fa98bad3fc8dd680dad18e Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 24 Nov 2019 17:07:06 +0100 Subject: [PATCH 03/22] . --- .gitignore | 3 ++- .../SpigotCore_8.iml => SpigotCore.iml | 1 - SpigotCore_12/SpigotCore_12.iml | 15 --------------- SpigotCore_14/SpigotCore_14.iml | 15 --------------- SpigotCore_Main/SpigotCore_Main.iml | 18 ------------------ 5 files changed, 2 insertions(+), 50 deletions(-) rename SpigotCore_8/SpigotCore_8.iml => SpigotCore.iml (87%) delete mode 100644 SpigotCore_12/SpigotCore_12.iml delete mode 100644 SpigotCore_14/SpigotCore_14.iml delete mode 100644 SpigotCore_Main/SpigotCore_Main.iml diff --git a/.gitignore b/.gitignore index 7eae63f..02142ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea target -dependency-reduced-pom.xml \ No newline at end of file +dependency-reduced-pom.xml +*.iml \ No newline at end of file diff --git a/SpigotCore_8/SpigotCore_8.iml b/SpigotCore.iml similarity index 87% rename from SpigotCore_8/SpigotCore_8.iml rename to SpigotCore.iml index 9c3822a..f368e86 100644 --- a/SpigotCore_8/SpigotCore_8.iml +++ b/SpigotCore.iml @@ -9,7 +9,6 @@ - \ No newline at end of file diff --git a/SpigotCore_12/SpigotCore_12.iml b/SpigotCore_12/SpigotCore_12.iml deleted file mode 100644 index 435bce5..0000000 --- a/SpigotCore_12/SpigotCore_12.iml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/SpigotCore_14/SpigotCore_14.iml b/SpigotCore_14/SpigotCore_14.iml deleted file mode 100644 index e977297..0000000 --- a/SpigotCore_14/SpigotCore_14.iml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/SpigotCore_Main/SpigotCore_Main.iml b/SpigotCore_Main/SpigotCore_Main.iml deleted file mode 100644 index 71dcca5..0000000 --- a/SpigotCore_Main/SpigotCore_Main.iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file -- 2.39.2 From fbbbc450fb509337a8e16615a344b0c3f50f9a01 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 24 Nov 2019 17:07:39 +0100 Subject: [PATCH 04/22] . --- SpigotCore.iml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 SpigotCore.iml diff --git a/SpigotCore.iml b/SpigotCore.iml deleted file mode 100644 index f368e86..0000000 --- a/SpigotCore.iml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file -- 2.39.2 From d4dcbfeafabfe10dd0e71dafdb72a034f1056952 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 24 Nov 2019 19:48:27 +0100 Subject: [PATCH 05/22] cleanup --- .../src/de/steamwar/core/Core.java | 3 + .../core/events/PlayerJoinedEvent.java | 3 + .../de/steamwar/scoreboard/SWScoreboard.java | 58 ++++++++++--------- .../scoreboard/ScoreboardContainer.java | 57 ------------------ 4 files changed, 36 insertions(+), 85 deletions(-) delete mode 100644 SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardContainer.java diff --git a/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore_Main/src/de/steamwar/core/Core.java index 21894c0..f71f947 100644 --- a/SpigotCore_Main/src/de/steamwar/core/Core.java +++ b/SpigotCore_Main/src/de/steamwar/core/Core.java @@ -2,6 +2,7 @@ package de.steamwar.core; import de.steamwar.core.events.ChattingEvent; import de.steamwar.core.events.PlayerJoinedEvent; +import de.steamwar.scoreboard.SWScoreboard; import de.steamwar.sql.SQL; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; @@ -34,6 +35,8 @@ public class Core extends JavaPlugin{ public void onEnable() { Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this); Bukkit.getPluginManager().registerEvents(new ChattingEvent(), this); + + SWScoreboard.startPlayerBoards(); } @Override diff --git a/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java b/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java index edae08e..cfb0667 100644 --- a/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java +++ b/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java @@ -1,5 +1,6 @@ package de.steamwar.core.events; +import de.steamwar.scoreboard.SWScoreboard; import de.steamwar.sql.SteamwarUser; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -51,5 +52,7 @@ public class PlayerJoinedEvent implements Listener{ Player player = event.getPlayer(); event.setQuitMessage("§c§l« §r" + player.getDisplayName()); + + SWScoreboard.getPlayerBoards().remove(player); } } diff --git a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java index d71e169..bb82126 100644 --- a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java +++ b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java @@ -3,6 +3,7 @@ package de.steamwar.scoreboard; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.PacketContainer; +import de.steamwar.core.Core; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -13,17 +14,15 @@ import java.util.logging.Level; public class SWScoreboard { - HashMap data; - private Player player; - private String title; + private static HashMap playerBoards = new HashMap<>(); - public SWScoreboard(Player player, HashMap data, String title) { - this.data = data; - this.player = player; - this.title = title; + ScoreboardCallback callback; + + public SWScoreboard(Player player, ScoreboardCallback callback) { + this.callback = callback; } - public void sendScoreboard() { + public 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); @@ -31,7 +30,7 @@ public class SWScoreboard { PacketContainer createpacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); createpacket.getStrings().write(0, "AAA"); createpacket.getBytes().write(0, (byte) 0); - createpacket.getStrings().write(1, this.title); + createpacket.getStrings().write(1, this.callback.getTitle()); createpacket.getIntegers().write(0, 0); try { @@ -41,7 +40,7 @@ public class SWScoreboard { Bukkit.getLogger().log(Level.SEVERE, "COULD NOT SEND PACKAGE", ex); } - for(Map.Entry entry : data.entrySet()) { + for(Map.Entry entry : this.callback.getData().entrySet()) { PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE); update.getStrings().write(0, entry.getKey()); update.getBytes().write(0, (byte) 0); @@ -57,10 +56,10 @@ public class SWScoreboard { } - public void display() { + public 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.title); + display.getStrings().write(0, this.callback.getTitle()); try { ProtocolLibrary.getProtocolManager().sendServerPacket(player, display); @@ -69,27 +68,30 @@ public class SWScoreboard { } } - public HashMap getData() { - return data; + 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()); + } + } + } + }, 10, 5); } - public void setData(HashMap data) { - this.data = data; + + public ScoreboardCallback getCallback() { + return callback; } - public Player getPlayer() { - return player; + public void setCallback(ScoreboardCallback callback) { + this.callback = callback; } - public void setPlayer(Player player) { - this.player = player; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; + public static HashMap getPlayerBoards() { + return playerBoards; } } diff --git a/SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardContainer.java b/SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardContainer.java deleted file mode 100644 index 8389c22..0000000 --- a/SpigotCore_Main/src/de/steamwar/scoreboard/ScoreboardContainer.java +++ /dev/null @@ -1,57 +0,0 @@ -package de.steamwar.scoreboard; - -import de.steamwar.core.Core; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.HashMap; -import java.util.UUID; - -public class ScoreboardContainer { - - private static HashMap containers = new HashMap<>(); - - Player player; - ScoreboardCallback callback; - - public ScoreboardContainer(Player player, ScoreboardCallback callback) { - this.player = player; - this.callback = callback; - } - - public void update() { - - //Update - SWScoreboard update = new SWScoreboard(player, callback.getData(), callback.getTitle()); - update.sendScoreboard(); - Bukkit.getScheduler().runTaskLater(Core.getInstance(), new Runnable() { - @Override - public void run() { - update.display(); - } - }, 2); - } - - public void startScoreboard() { - Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getInstance(), new Runnable() { - @Override - public void run() { - for(ScoreboardContainer container : ScoreboardContainer.getContainers().values()) { - container.update(); - } - } - }, 10, 5); - } - - public Player getPlayer() { - return player; - } - - public void setPlayer(Player player) { - this.player = player; - } - - public static HashMap getContainers() { - return containers; - } -} -- 2.39.2 From bc81ef6424691a87aee5b152a2dc5b16bcbf3e3b Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 24 Nov 2019 19:51:52 +0100 Subject: [PATCH 06/22] cleanup --- .../de/steamwar/scoreboard/SWScoreboard.java | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) 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; } -- 2.39.2 From 1631cd848638e0363c19e5f4bb54efa20d916b89 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 24 Nov 2019 19:55:07 +0100 Subject: [PATCH 07/22] cleanup --- SpigotCore_Main/src/de/steamwar/core/Core.java | 2 -- SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore_Main/src/de/steamwar/core/Core.java index f71f947..2beb20f 100644 --- a/SpigotCore_Main/src/de/steamwar/core/Core.java +++ b/SpigotCore_Main/src/de/steamwar/core/Core.java @@ -35,8 +35,6 @@ public class Core extends JavaPlugin{ public void onEnable() { Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this); Bukkit.getPluginManager().registerEvents(new ChattingEvent(), this); - - SWScoreboard.startPlayerBoards(); } @Override diff --git a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java index 5fccaa0..4a12581 100644 --- a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java +++ b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java @@ -68,7 +68,7 @@ public class SWScoreboard { } } - public static void startPlayerBoards() { + static { Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getInstance(), () -> { synchronized (playerBoards) { for(Map.Entry entry : playerBoards.entrySet()) { -- 2.39.2 From ec2a0345aaf1b930d49c7d37e9ddd1ecec231067 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 24 Nov 2019 19:56:36 +0100 Subject: [PATCH 08/22] cleanup --- SpigotCore_Main/src/de/steamwar/core/Core.java | 1 - 1 file changed, 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore_Main/src/de/steamwar/core/Core.java index 2beb20f..21894c0 100644 --- a/SpigotCore_Main/src/de/steamwar/core/Core.java +++ b/SpigotCore_Main/src/de/steamwar/core/Core.java @@ -2,7 +2,6 @@ package de.steamwar.core; import de.steamwar.core.events.ChattingEvent; import de.steamwar.core.events.PlayerJoinedEvent; -import de.steamwar.scoreboard.SWScoreboard; import de.steamwar.sql.SQL; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; -- 2.39.2 From 39c6d04daf12dca0eafc9d758dad1289b0abd350 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 24 Nov 2019 21:51:39 +0100 Subject: [PATCH 09/22] added full multiversion support --- .../steamwar/scoreboard/SWScoreboard_12.java | 44 ++++++++++++++ .../steamwar/scoreboard/SWScoreboard_14.java | 44 ++++++++++++++ .../steamwar/scoreboard/SWScoreboard_8.java | 44 ++++++++++++++ .../de/steamwar/scoreboard/SWScoreboard.java | 58 +++++++++++++------ 4 files changed, 172 insertions(+), 18 deletions(-) create mode 100644 SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java create mode 100644 SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java create mode 100644 SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java diff --git a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java new file mode 100644 index 0000000..1f4b8ef --- /dev/null +++ b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java @@ -0,0 +1,44 @@ +package de.steamwar.scoreboard; + +import com.comphenix.protocol.PacketType; +import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.events.PacketContainer; + +public class SWScoreboard_12 { + + private SWScoreboard_12() {} + + static PacketContainer getRemovePacket() { + PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); + remove.getStrings().write(0, "AAA"); + remove.getBytes().write(0, (byte) 1); + return remove; + } + + static PacketContainer getCreatePacket(String title) { + PacketContainer createpacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); + createpacket.getStrings().write(0, "AAA"); + createpacket.getBytes().write(0, (byte) 0); + createpacket.getStrings().write(1, title); + createpacket.getStrings().write(2, "integer"); + return createpacket; + } + + static PacketContainer getUpdatePacket(String content, Integer line) { + PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE); + update.getStrings().write(0, content); + update.getBytes().write(0, (byte) 0); + update.getStrings().write(1, "AAA"); + update.getIntegers().write(0, line); + return update; + } + + static PacketContainer getDisplayPacket(String title) { + PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE); + display.getBytes().write(0, (byte) 1); + display.getStrings().write(0, title); + return display; + } + + +} diff --git a/SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java b/SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java new file mode 100644 index 0000000..89e1f06 --- /dev/null +++ b/SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java @@ -0,0 +1,44 @@ +package de.steamwar.scoreboard; + +import com.comphenix.protocol.PacketType; +import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.events.PacketContainer; + +public class SWScoreboard_14 { + + private SWScoreboard_14() {} + + static PacketContainer getRemovePacket() { + PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); + remove.getStrings().write(0, "AAA"); + remove.getBytes().write(0, (byte) 1); + return remove; + } + + static PacketContainer getCreatePacket(String title) { + PacketContainer createpacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); + createpacket.getStrings().write(0, "AAA"); + createpacket.getBytes().write(0, (byte) 0); + createpacket.getStrings().write(1, title); + createpacket.getIntegers().write(0, 0); + return createpacket; + } + + static PacketContainer getUpdatePacket(String content, Integer line) { + PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE); + update.getStrings().write(0, content); + update.getBytes().write(0, (byte) 0); + update.getStrings().write(1, "AAA"); + update.getIntegers().write(0, line); + return update; + } + + static PacketContainer getDisplayPacket(String title) { + PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE); + display.getBytes().write(0, (byte) 1); + display.getStrings().write(0, title); + return display; + } + + +} diff --git a/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java b/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java new file mode 100644 index 0000000..c3d2441 --- /dev/null +++ b/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java @@ -0,0 +1,44 @@ +package de.steamwar.scoreboard; + +import com.comphenix.protocol.PacketType; +import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.events.PacketContainer; + +public class SWScoreboard_8 { + + private SWScoreboard_8() {} + + static PacketContainer getRemovePacket() { + PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); + remove.getStrings().write(0, "AAA"); + remove.getBytes().write(0, (byte) 1); + return remove; + } + + static PacketContainer getCreatePacket(String title) { + PacketContainer createpacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); + createpacket.getStrings().write(0, "AAA"); + createpacket.getBytes().write(0, (byte) 0); + createpacket.getStrings().write(1, title); + createpacket.getStrings().write(2, "integer"); + return createpacket; + } + + static PacketContainer getUpdatePacket(String content, Integer line) { + PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE); + update.getStrings().write(0, content); + update.getBytes().write(0, (byte) 0); + update.getStrings().write(1, "AAA"); + update.getIntegers().write(0, line); + return update; + } + + static PacketContainer getDisplayPacket(String title) { + PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE); + display.getBytes().write(0, (byte) 1); + display.getStrings().write(0, title); + return display; + } + + +} diff --git a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java index 4a12581..b8ec5ff 100644 --- a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java +++ b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java @@ -1,6 +1,5 @@ package de.steamwar.scoreboard; -import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.PacketContainer; import de.steamwar.core.Core; @@ -23,15 +22,21 @@ public class SWScoreboard { } 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); - - PacketContainer createpacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); - createpacket.getStrings().write(0, "AAA"); - createpacket.getBytes().write(0, (byte) 0); - createpacket.getStrings().write(1, this.callback.getTitle()); - createpacket.getIntegers().write(0, 0); + PacketContainer remove; + PacketContainer createpacket; + switch (Core.getVersion()) { + case 8: + remove = SWScoreboard_8.getRemovePacket(); + createpacket = SWScoreboard_8.getCreatePacket(this.callback.getTitle()); + break; + case 14: + remove = SWScoreboard_14.getRemovePacket(); + createpacket = SWScoreboard_14.getCreatePacket(this.callback.getTitle()); + break; + default: + remove = SWScoreboard_12.getRemovePacket(); + createpacket = SWScoreboard_12.getCreatePacket(this.callback.getTitle()); + } try { ProtocolLibrary.getProtocolManager().sendServerPacket(player, remove); @@ -41,11 +46,18 @@ public class SWScoreboard { } for(Map.Entry entry : this.callback.getData().entrySet()) { - PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE); - update.getStrings().write(0, entry.getKey()); - update.getBytes().write(0, (byte) 0); - update.getStrings().write(1, "AAA"); - update.getIntegers().write(0, entry.getValue()); + PacketContainer update; + + switch (Core.getVersion()) { + case 8: + update = SWScoreboard_8.getUpdatePacket(entry.getKey(), entry.getValue()); + break; + case 14: + update = SWScoreboard_14.getUpdatePacket(entry.getKey(), entry.getValue()); + break; + default: + update = SWScoreboard_12.getUpdatePacket(entry.getKey(), entry.getValue()); + } try { ProtocolLibrary.getProtocolManager().sendServerPacket(player, update); @@ -57,9 +69,19 @@ public class SWScoreboard { } 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()); + PacketContainer display; + + switch (Core.getVersion()) { + case 8: + display = SWScoreboard_8.getDisplayPacket(this.callback.getTitle()); + break; + case 14: + display = SWScoreboard_14.getDisplayPacket(this.callback.getTitle()); + break; + default: + display = SWScoreboard_12.getDisplayPacket(this.callback.getTitle()); + + } try { ProtocolLibrary.getProtocolManager().sendServerPacket(player, display); -- 2.39.2 From 28c84fa5e2cc5afc9388b91bafd93078d3c4381e Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 25 Nov 2019 19:37:08 +0100 Subject: [PATCH 10/22] rework of multiversion support --- SpigotCore_12/pom.xml | 5 ++++ .../steamwar/scoreboard/SWScoreboard_12.java | 26 +++---------------- SpigotCore_14/pom.xml | 5 ++++ .../steamwar/scoreboard/SWScoreboard_14.java | 17 +++--------- 4 files changed, 17 insertions(+), 36 deletions(-) diff --git a/SpigotCore_12/pom.xml b/SpigotCore_12/pom.xml index eb4680f..19d5cea 100644 --- a/SpigotCore_12/pom.xml +++ b/SpigotCore_12/pom.xml @@ -33,5 +33,10 @@ 1.12 provided + + steamwar + SpigotCore_8 + 2.0 + \ No newline at end of file diff --git a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java index 1f4b8ef..2a14c7c 100644 --- a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java +++ b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java @@ -1,7 +1,5 @@ package de.steamwar.scoreboard; -import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.PacketContainer; public class SWScoreboard_12 { @@ -9,35 +7,19 @@ public class SWScoreboard_12 { private SWScoreboard_12() {} static PacketContainer getRemovePacket() { - PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); - remove.getStrings().write(0, "AAA"); - remove.getBytes().write(0, (byte) 1); - return remove; + return SWScoreboard_8.getRemovePacket(); } static PacketContainer getCreatePacket(String title) { - PacketContainer createpacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); - createpacket.getStrings().write(0, "AAA"); - createpacket.getBytes().write(0, (byte) 0); - createpacket.getStrings().write(1, title); - createpacket.getStrings().write(2, "integer"); - return createpacket; + return SWScoreboard_8.getCreatePacket(title); } static PacketContainer getUpdatePacket(String content, Integer line) { - PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE); - update.getStrings().write(0, content); - update.getBytes().write(0, (byte) 0); - update.getStrings().write(1, "AAA"); - update.getIntegers().write(0, line); - return update; + return SWScoreboard_8.getUpdatePacket(content, line); } static PacketContainer getDisplayPacket(String title) { - PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE); - display.getBytes().write(0, (byte) 1); - display.getStrings().write(0, title); - return display; + return SWScoreboard_8.getDisplayPacket(title); } diff --git a/SpigotCore_14/pom.xml b/SpigotCore_14/pom.xml index 9b030de..65db327 100644 --- a/SpigotCore_14/pom.xml +++ b/SpigotCore_14/pom.xml @@ -33,5 +33,10 @@ 1.14 provided + + steamwar + SpigotCore_8 + 2.0 + \ No newline at end of file diff --git a/SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java b/SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java index 89e1f06..fa71963 100644 --- a/SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java +++ b/SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java @@ -9,10 +9,7 @@ public class SWScoreboard_14 { private SWScoreboard_14() {} static PacketContainer getRemovePacket() { - PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); - remove.getStrings().write(0, "AAA"); - remove.getBytes().write(0, (byte) 1); - return remove; + return SWScoreboard_8.getRemovePacket(); } static PacketContainer getCreatePacket(String title) { @@ -25,19 +22,11 @@ public class SWScoreboard_14 { } static PacketContainer getUpdatePacket(String content, Integer line) { - PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE); - update.getStrings().write(0, content); - update.getBytes().write(0, (byte) 0); - update.getStrings().write(1, "AAA"); - update.getIntegers().write(0, line); - return update; + return SWScoreboard_8.getUpdatePacket(content, line); } static PacketContainer getDisplayPacket(String title) { - PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE); - display.getBytes().write(0, (byte) 1); - display.getStrings().write(0, title); - return display; + return SWScoreboard_8.getDisplayPacket(title); } -- 2.39.2 From 7453f0d39b467de9f13b3689e1f45228f6bae374 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 5 Dec 2019 19:11:47 +0100 Subject: [PATCH 11/22] untested rework of dependent scoreboard source --- .../steamwar/scoreboard/SWScoreboard_12.java | 18 ++++---- .../steamwar/scoreboard/SWScoreboard_8.java | 45 +++++++++---------- 2 files changed, 29 insertions(+), 34 deletions(-) diff --git a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java index 2a14c7c..41fc384 100644 --- a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java +++ b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java @@ -1,25 +1,23 @@ package de.steamwar.scoreboard; -import com.comphenix.protocol.events.PacketContainer; - public class SWScoreboard_12 { private SWScoreboard_12() {} - static PacketContainer getRemovePacket() { - return SWScoreboard_8.getRemovePacket(); + static void sendRemovePacket() { + SWScoreboard_8.sendRemovePacket(); } - static PacketContainer getCreatePacket(String title) { - return SWScoreboard_8.getCreatePacket(title); + static void sendCreatePacket(String title) { + SWScoreboard_8.sendCreatePacket(title); } - static PacketContainer getUpdatePacket(String content, Integer line) { - return SWScoreboard_8.getUpdatePacket(content, line); + static void sendUpdatePacket(String content, Integer line) { + SWScoreboard_8.sendUpdatePacket(content, line); } - static PacketContainer getDisplayPacket(String title) { - return SWScoreboard_8.getDisplayPacket(title); + static void sendDisplayPacket() { + SWScoreboard_8.sendDisplayPacket(); } diff --git a/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java b/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java index c3d2441..6069df4 100644 --- a/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java +++ b/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java @@ -8,36 +8,33 @@ public class SWScoreboard_8 { private SWScoreboard_8() {} - static PacketContainer getRemovePacket() { - PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); - remove.getStrings().write(0, "AAA"); - remove.getBytes().write(0, (byte) 1); - return remove; + static void sendRemovePacket() { + PacketContainer removePacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); + removePacket.getStrings().write(0, "AAA"); + removePacket.getIntegers().write(0, 1); + //TODO kann vlt entfernt werden -> remove.getStrings().write(1, "integer"); } - static PacketContainer getCreatePacket(String title) { - PacketContainer createpacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); - createpacket.getStrings().write(0, "AAA"); - createpacket.getBytes().write(0, (byte) 0); - createpacket.getStrings().write(1, title); - createpacket.getStrings().write(2, "integer"); - return createpacket; + static void sendCreatePacket(String title) { + PacketContainer createPacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); + createPacket.getStrings().write(0, "AAA"); + createPacket.getIntegers().write(0, 0); + createPacket.getStrings().write(1, title); + createPacket.getStrings().write(2, "integer"); } - static PacketContainer getUpdatePacket(String content, Integer line) { - PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE); - update.getStrings().write(0, content); - update.getBytes().write(0, (byte) 0); - update.getStrings().write(1, "AAA"); - update.getIntegers().write(0, line); - return update; + static void sendUpdatePacket(String content, Integer line) { + PacketContainer updatePacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE); + updatePacket.getStrings().write(0, content); + updatePacket.getStrings().write(1, "AAA"); + updatePacket.getIntegers().write(0, line); + updatePacket.getBytes().write(0, (byte) 0); } - static PacketContainer getDisplayPacket(String title) { - PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE); - display.getBytes().write(0, (byte) 1); - display.getStrings().write(0, title); - return display; + static void sendDisplayPacket() { + PacketContainer displayPacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE); + displayPacket.getIntegers().write(0, 1); + displayPacket.getStrings().write(0, "AAA"); } -- 2.39.2 From 82cec029ecda5c03a2408f684b3dc47c0a89c445 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 5 Dec 2019 19:23:38 +0100 Subject: [PATCH 12/22] untested rework of dependent scoreboard source --- .../src/de/steamwar/scoreboard/SWScoreboard_14.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java b/SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java index fa71963..f0cb561 100644 --- a/SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java +++ b/SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java @@ -9,7 +9,7 @@ public class SWScoreboard_14 { private SWScoreboard_14() {} static PacketContainer getRemovePacket() { - return SWScoreboard_8.getRemovePacket(); + return null; //Todo SWScoreboard_8.getRemovePacket(); } static PacketContainer getCreatePacket(String title) { @@ -22,11 +22,11 @@ public class SWScoreboard_14 { } static PacketContainer getUpdatePacket(String content, Integer line) { - return SWScoreboard_8.getUpdatePacket(content, line); + return null; //todo SWScoreboard_8.getUpdatePacket(content, line); } static PacketContainer getDisplayPacket(String title) { - return SWScoreboard_8.getDisplayPacket(title); + return null; //TOdo SWScoreboard_8.getDisplayPacket(title); } -- 2.39.2 From 473d78ce7546de64abe72f24668c1761a8d0ff85 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 5 Dec 2019 19:33:34 +0100 Subject: [PATCH 13/22] untested rework of dependent scoreboard source --- .../steamwar/scoreboard/SWScoreboard_12.java | 18 ++++--- .../steamwar/scoreboard/SWScoreboard_8.java | 29 ++++++++-- .../de/steamwar/scoreboard/SWScoreboard.java | 53 +++++-------------- 3 files changed, 47 insertions(+), 53 deletions(-) diff --git a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java index 41fc384..494d264 100644 --- a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java +++ b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java @@ -1,23 +1,25 @@ package de.steamwar.scoreboard; +import org.bukkit.entity.Player; + public class SWScoreboard_12 { private SWScoreboard_12() {} - static void sendRemovePacket() { - SWScoreboard_8.sendRemovePacket(); + static void sendRemovePacket(Player player) { + SWScoreboard_8.sendRemovePacket(player); } - static void sendCreatePacket(String title) { - SWScoreboard_8.sendCreatePacket(title); + static void sendCreatePacket(String title, Player player) { + SWScoreboard_8.sendCreatePacket(title, player); } - static void sendUpdatePacket(String content, Integer line) { - SWScoreboard_8.sendUpdatePacket(content, line); + static void sendUpdatePacket(String content, Integer line, Player player) { + SWScoreboard_8.sendUpdatePacket(content, line, player); } - static void sendDisplayPacket() { - SWScoreboard_8.sendDisplayPacket(); + static void sendDisplayPacket(Player player) { + SWScoreboard_8.sendDisplayPacket(player); } diff --git a/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java b/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java index 6069df4..9afcbc9 100644 --- a/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java +++ b/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java @@ -3,38 +3,59 @@ package de.steamwar.scoreboard; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.PacketContainer; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import java.lang.reflect.InvocationTargetException; +import java.util.logging.Level; public class SWScoreboard_8 { private SWScoreboard_8() {} - static void sendRemovePacket() { + static void sendRemovePacket(Player player) { PacketContainer removePacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); removePacket.getStrings().write(0, "AAA"); removePacket.getIntegers().write(0, 1); //TODO kann vlt entfernt werden -> remove.getStrings().write(1, "integer"); + + sendPacket(player, removePacket); } - static void sendCreatePacket(String title) { + static void sendCreatePacket(String title, Player player) { PacketContainer createPacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); createPacket.getStrings().write(0, "AAA"); createPacket.getIntegers().write(0, 0); createPacket.getStrings().write(1, title); createPacket.getStrings().write(2, "integer"); + + sendPacket(player, createPacket); } - static void sendUpdatePacket(String content, Integer line) { + static void sendUpdatePacket(String content, Integer line, Player player) { PacketContainer updatePacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE); updatePacket.getStrings().write(0, content); updatePacket.getStrings().write(1, "AAA"); updatePacket.getIntegers().write(0, line); updatePacket.getBytes().write(0, (byte) 0); + + sendPacket(player, updatePacket); } - static void sendDisplayPacket() { + static void sendDisplayPacket(Player player) { PacketContainer displayPacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE); displayPacket.getIntegers().write(0, 1); displayPacket.getStrings().write(0, "AAA"); + + sendPacket(player, displayPacket); + } + + private static void sendPacket(Player player, PacketContainer packetContainer) { + try { + ProtocolLibrary.getProtocolManager().sendServerPacket(player, packetContainer); + } catch (InvocationTargetException ex) { + Bukkit.getLogger().log(Level.SEVERE, "COULD NOT SEND PACKAGE", ex); + } } diff --git a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java index b8ec5ff..4b329f3 100644 --- a/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java +++ b/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java @@ -1,15 +1,11 @@ package de.steamwar.scoreboard; -import com.comphenix.protocol.ProtocolLibrary; -import com.comphenix.protocol.events.PacketContainer; import de.steamwar.core.Core; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; -import java.util.logging.Level; public class SWScoreboard { @@ -22,72 +18,47 @@ public class SWScoreboard { } private void sendScoreboard(Player player) { - PacketContainer remove; - PacketContainer createpacket; switch (Core.getVersion()) { case 8: - remove = SWScoreboard_8.getRemovePacket(); - createpacket = SWScoreboard_8.getCreatePacket(this.callback.getTitle()); + SWScoreboard_8.sendRemovePacket(player); + SWScoreboard_8.sendCreatePacket(this.callback.getTitle(), player); break; case 14: - remove = SWScoreboard_14.getRemovePacket(); - createpacket = SWScoreboard_14.getCreatePacket(this.callback.getTitle()); + //Todo remove = SWScoreboard_14.getRemovePacket(); + //Todo createpacket = SWScoreboard_14.getCreatePacket(this.callback.getTitle()); break; default: - remove = SWScoreboard_12.getRemovePacket(); - createpacket = SWScoreboard_12.getCreatePacket(this.callback.getTitle()); - } - - try { - ProtocolLibrary.getProtocolManager().sendServerPacket(player, remove); - ProtocolLibrary.getProtocolManager().sendServerPacket(player, createpacket); - } catch (InvocationTargetException ex) { - Bukkit.getLogger().log(Level.SEVERE, "COULD NOT SEND PACKAGE", ex); + SWScoreboard_12.sendRemovePacket(player); + SWScoreboard_12.sendCreatePacket(this.callback.getTitle(), player); } for(Map.Entry entry : this.callback.getData().entrySet()) { - PacketContainer update; - switch (Core.getVersion()) { case 8: - update = SWScoreboard_8.getUpdatePacket(entry.getKey(), entry.getValue()); + SWScoreboard_8.sendUpdatePacket(entry.getKey(), entry.getValue(), player); break; case 14: - update = SWScoreboard_14.getUpdatePacket(entry.getKey(), entry.getValue()); + //Todo update = SWScoreboard_14.getUpdatePacket(entry.getKey(), entry.getValue()); break; default: - update = SWScoreboard_12.getUpdatePacket(entry.getKey(), entry.getValue()); - } - - try { - ProtocolLibrary.getProtocolManager().sendServerPacket(player, update); - } catch (InvocationTargetException ex) { - Bukkit.getLogger().log(Level.SEVERE, "COULD NOT SEND PACKAGE", ex); + SWScoreboard_12.sendUpdatePacket(entry.getKey(), entry.getValue(), player); } } } private void display(Player player) { - PacketContainer display; - switch (Core.getVersion()) { case 8: - display = SWScoreboard_8.getDisplayPacket(this.callback.getTitle()); + SWScoreboard_8.sendDisplayPacket(player); break; case 14: - display = SWScoreboard_14.getDisplayPacket(this.callback.getTitle()); + //Todo display = SWScoreboard_14.getDisplayPacket(this.callback.getTitle()); break; default: - display = SWScoreboard_12.getDisplayPacket(this.callback.getTitle()); + SWScoreboard_12.sendDisplayPacket(player); } - - try { - ProtocolLibrary.getProtocolManager().sendServerPacket(player, display); - } catch (InvocationTargetException ex) { - Bukkit.getLogger().log(Level.SEVERE, "COULD NOT SEND PACKAGE", ex); - } } static { -- 2.39.2 From 252fa4a767531a401f5e13bffc96abad89ef43c5 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 5 Dec 2019 19:53:21 +0100 Subject: [PATCH 14/22] untested rework of dependent scoreboard source --- SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java b/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java index 9afcbc9..cbfb653 100644 --- a/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java +++ b/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java @@ -3,6 +3,7 @@ package de.steamwar.scoreboard; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.PacketContainer; +import net.minecraft.server.v1_8_R3.IScoreboardCriteria; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -27,7 +28,7 @@ public class SWScoreboard_8 { createPacket.getStrings().write(0, "AAA"); createPacket.getIntegers().write(0, 0); createPacket.getStrings().write(1, title); - createPacket.getStrings().write(2, "integer"); + createPacket.getEnumModifier(IScoreboardCriteria.EnumScoreboardHealthDisplay.class, 0).getTarget(); sendPacket(player, createPacket); } -- 2.39.2 From b15552ae74dc9d3eb6ef22cfcab0d29c90a747cc Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 5 Dec 2019 19:57:17 +0100 Subject: [PATCH 15/22] untested rework of dependent scoreboard source --- SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java b/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java index cbfb653..d9d7873 100644 --- a/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java +++ b/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java @@ -28,7 +28,7 @@ public class SWScoreboard_8 { createPacket.getStrings().write(0, "AAA"); createPacket.getIntegers().write(0, 0); createPacket.getStrings().write(1, title); - createPacket.getEnumModifier(IScoreboardCriteria.EnumScoreboardHealthDisplay.class, 0).getTarget(); + createPacket.getEnumModifier(IScoreboardCriteria.EnumScoreboardHealthDisplay.class, 0).write(0, IScoreboardCriteria.EnumScoreboardHealthDisplay.INTEGER); sendPacket(player, createPacket); } -- 2.39.2 From 2b0f64d86d56b6b3bf1c4a15c6d440f29b79fd4e Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 5 Dec 2019 20:01:37 +0100 Subject: [PATCH 16/22] untested rework of dependent scoreboard source --- .../steamwar/scoreboard/SWScoreboard_12.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java index 494d264..b318d05 100644 --- a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java +++ b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java @@ -1,7 +1,15 @@ package de.steamwar.scoreboard; +import com.comphenix.protocol.PacketType; +import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.events.PacketContainer; +import net.minecraft.server.v1_12_R1.IScoreboardCriteria; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import java.lang.reflect.InvocationTargetException; +import java.util.logging.Level; + public class SWScoreboard_12 { private SWScoreboard_12() {} @@ -11,7 +19,13 @@ public class SWScoreboard_12 { } static void sendCreatePacket(String title, Player player) { - SWScoreboard_8.sendCreatePacket(title, player); + PacketContainer createPacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE); + createPacket.getStrings().write(0, "AAA"); + createPacket.getIntegers().write(0, 0); + createPacket.getStrings().write(1, title); + createPacket.getEnumModifier(IScoreboardCriteria.EnumScoreboardHealthDisplay.class, 0).write(0, IScoreboardCriteria.EnumScoreboardHealthDisplay.INTEGER); + + sendPacket(player, createPacket); } static void sendUpdatePacket(String content, Integer line, Player player) { @@ -22,5 +36,13 @@ public class SWScoreboard_12 { SWScoreboard_8.sendDisplayPacket(player); } + private static void sendPacket(Player player, PacketContainer packetContainer) { + try { + ProtocolLibrary.getProtocolManager().sendServerPacket(player, packetContainer); + } catch (InvocationTargetException ex) { + Bukkit.getLogger().log(Level.SEVERE, "COULD NOT SEND PACKAGE", ex); + } + } + } -- 2.39.2 From 5c0a8715fdb7101c4da68dd13f230dc87e1e12d1 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 5 Dec 2019 20:07:14 +0100 Subject: [PATCH 17/22] untested rework of dependent scoreboard source --- SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java index b318d05..73fe13a 100644 --- a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java +++ b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java @@ -3,6 +3,7 @@ package de.steamwar.scoreboard; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.events.PacketContainer; +import com.comphenix.protocol.reflect.StructureModifier; import net.minecraft.server.v1_12_R1.IScoreboardCriteria; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -23,7 +24,8 @@ public class SWScoreboard_12 { createPacket.getStrings().write(0, "AAA"); createPacket.getIntegers().write(0, 0); createPacket.getStrings().write(1, title); - createPacket.getEnumModifier(IScoreboardCriteria.EnumScoreboardHealthDisplay.class, 0).write(0, IScoreboardCriteria.EnumScoreboardHealthDisplay.INTEGER); + StructureModifier modifier = createPacket.getEnumModifier(IScoreboardCriteria.EnumScoreboardHealthDisplay.class, 0); + modifier.write(0, IScoreboardCriteria.EnumScoreboardHealthDisplay.INTEGER); sendPacket(player, createPacket); } -- 2.39.2 From 38d398b899c7c301f3f9889d0fcfe632229c42fe Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 5 Dec 2019 20:14:04 +0100 Subject: [PATCH 18/22] untested rework of dependent scoreboard source --- SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java index 73fe13a..9df5e90 100644 --- a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java +++ b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java @@ -25,7 +25,7 @@ public class SWScoreboard_12 { createPacket.getIntegers().write(0, 0); createPacket.getStrings().write(1, title); StructureModifier modifier = createPacket.getEnumModifier(IScoreboardCriteria.EnumScoreboardHealthDisplay.class, 0); - modifier.write(0, IScoreboardCriteria.EnumScoreboardHealthDisplay.INTEGER); + modifier.write(0, "integer"); sendPacket(player, createPacket); } -- 2.39.2 From 17d8580d6ed852650aac75fb14b242e7a6cb513e Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 5 Dec 2019 20:29:15 +0100 Subject: [PATCH 19/22] untested rework of dependent scoreboard source --- SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java index 9df5e90..9ac553d 100644 --- a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java +++ b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java @@ -25,7 +25,7 @@ public class SWScoreboard_12 { createPacket.getIntegers().write(0, 0); createPacket.getStrings().write(1, title); StructureModifier modifier = createPacket.getEnumModifier(IScoreboardCriteria.EnumScoreboardHealthDisplay.class, 0); - modifier.write(0, "integer"); + modifier.write(0, modifier.getTarget()); sendPacket(player, createPacket); } -- 2.39.2 From 60f93d0e3f17c28e7eb78afc96af1a771d73a5fd Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 5 Dec 2019 20:42:23 +0100 Subject: [PATCH 20/22] untested rework of dependent scoreboard source --- .../de/steamwar/scoreboard/SWScoreboard_12.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java index 9ac553d..743a9a8 100644 --- a/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java +++ b/SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java @@ -25,7 +25,7 @@ public class SWScoreboard_12 { createPacket.getIntegers().write(0, 0); createPacket.getStrings().write(1, title); StructureModifier modifier = createPacket.getEnumModifier(IScoreboardCriteria.EnumScoreboardHealthDisplay.class, 0); - modifier.write(0, modifier.getTarget()); + modifier.write(0, SWEnumScoreboardHealtyDisplay.INTEGER); sendPacket(player, createPacket); } @@ -46,5 +46,20 @@ public class SWScoreboard_12 { } } + static enum SWEnumScoreboardHealtyDisplay { + INTEGER("integer"), + HEARTS("hearts"); + + private String string; + + private SWEnumScoreboardHealtyDisplay(String string) { + this.string = string; + } + + public String getString() { + return string; + } + } + } -- 2.39.2 From 7d78c28af585ecd333adcb0c74b704f3157a8bd0 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 5 Dec 2019 20:45:46 +0100 Subject: [PATCH 21/22] untested rework of dependent scoreboard source --- .../core/events/PlayerJoinedEvent.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java b/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java index cfb0667..0ef2da6 100644 --- a/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java +++ b/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java @@ -1,6 +1,7 @@ package de.steamwar.core.events; import de.steamwar.scoreboard.SWScoreboard; +import de.steamwar.scoreboard.ScoreboardCallback; import de.steamwar.sql.SteamwarUser; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -8,6 +9,8 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; +import java.util.HashMap; + public class PlayerJoinedEvent implements Listener{ @@ -54,5 +57,24 @@ public class PlayerJoinedEvent implements Listener{ event.setQuitMessage("§c§l« §r" + player.getDisplayName()); SWScoreboard.getPlayerBoards().remove(player); + + + + //TEST + SWScoreboard swScoreboard = new SWScoreboard(new ScoreboardCallback() { + @Override + public HashMap getData() { + HashMap data = new HashMap<>(); + data.put("bla", 2); + data.put("lala", 3); + return data; + } + + @Override + public String getTitle() { + return "ES GEHT!!!!"; + } + }); + SWScoreboard.getPlayerBoards().put(player, swScoreboard); } } -- 2.39.2 From 2cd3334b99cf4ec65c84001e48230a2d049f665e Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 5 Dec 2019 20:49:17 +0100 Subject: [PATCH 22/22] untested rework of dependent scoreboard source --- .../core/events/PlayerJoinedEvent.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java b/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java index 0ef2da6..71d95ec 100644 --- a/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java +++ b/SpigotCore_Main/src/de/steamwar/core/events/PlayerJoinedEvent.java @@ -48,16 +48,6 @@ public class PlayerJoinedEvent implements Listener{ } event.setJoinMessage("§a§l» §r" + player.getDisplayName()); - } - - @EventHandler - private void onQuit(PlayerQuitEvent event) { - Player player = event.getPlayer(); - - event.setQuitMessage("§c§l« §r" + player.getDisplayName()); - - SWScoreboard.getPlayerBoards().remove(player); - //TEST @@ -77,4 +67,13 @@ public class PlayerJoinedEvent implements Listener{ }); SWScoreboard.getPlayerBoards().put(player, swScoreboard); } + + @EventHandler + private void onQuit(PlayerQuitEvent event) { + Player player = event.getPlayer(); + + event.setQuitMessage("§c§l« §r" + player.getDisplayName()); + + SWScoreboard.getPlayerBoards().remove(player); + } } -- 2.39.2