From 28c84fa5e2cc5afc9388b91bafd93078d3c4381e Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 25 Nov 2019 19:37:08 +0100 Subject: [PATCH] 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); }