diff --git a/NovaCore-Spigot_v1_18_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R1/PlayerBoardV1_18_R1.java b/NovaCore-Spigot_v1_18_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R1/PlayerBoardV1_18_R1.java deleted file mode 100644 index 89c334c..0000000 --- a/NovaCore-Spigot_v1_18_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R1/PlayerBoardV1_18_R1.java +++ /dev/null @@ -1,84 +0,0 @@ -package net.zeeraa.novacore.spigot.version.v1_18_R1; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_18_R1.scoreboard.CraftScoreboard; -import org.bukkit.entity.Player; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Scoreboard; - -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardDisplayObjective; -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardObjective; -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardScore; -import net.minecraft.server.ScoreboardServer.Action; -import net.minecraft.server.level.EntityPlayer; -import net.minecraft.world.scores.ScoreboardObjective; -import net.minecraft.world.scores.ScoreboardScore; -import net.zeeraa.novacore.commons.utils.ReflectUtils; -import net.zeeraa.novacore.spigot.abstraction.INetheriteBoard; -import net.zeeraa.novacore.spigot.abstraction.enums.ObjectiveMode; -import net.zeeraa.novacore.spigot.abstraction.netheriteboard.BPlayerBoard; - -public class PlayerBoardV1_18_R1 extends BPlayerBoard { - private EntityPlayer playerHandle; - private Field playerScoreField; - - public PlayerBoardV1_18_R1(INetheriteBoard netheriteBoard, Player player, String name) throws Exception { - this(netheriteBoard, player, null, name); - } - - public PlayerBoardV1_18_R1(INetheriteBoard netheriteBoard, Player player, Scoreboard scoreboard, String name) throws Exception { - super(netheriteBoard, player, scoreboard, name); - playerHandle = ((CraftPlayer) player).getHandle(); - - playerScoreField = net.minecraft.world.scores.Scoreboard.class.getDeclaredField("j"); - playerScoreField.setAccessible(true); - - this.init(); - } - - @Override - protected void sendObjective(Objective objective, ObjectiveMode mode) throws Exception { - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - PacketPlayOutScoreboardObjective packet = new PacketPlayOutScoreboardObjective(nmsObjective, mode.ordinal()); - playerHandle.b.a(packet); - } - - @Override - protected void sendObjectiveDisplay(Objective objective) throws Exception { - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - PacketPlayOutScoreboardDisplayObjective packet = new PacketPlayOutScoreboardDisplayObjective(1, nmsObjective); - playerHandle.b.a(packet); - } - - @Override - protected void sendScore(Objective objective, String name, int score, boolean remove) throws Exception { - net.minecraft.world.scores.Scoreboard nmsScoreboard = ((CraftScoreboard) this.scoreboard).getHandle(); - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - - ScoreboardScore scoreboardScore = new ScoreboardScore(nmsScoreboard, nmsObjective, name); - scoreboardScore.b(score); - - @SuppressWarnings("unchecked") - Map> scores = (Map>) playerScoreField.get(nmsScoreboard); - - if (remove) { - if (scores.containsKey(name)) { - scores.get(name).remove(nmsObjective); - } - } else { - if (!scores.containsKey(name)) { - scores.put(name, new HashMap<>()); - } - - scores.get(name).put(nmsObjective, scoreboardScore); - } - - PacketPlayOutScoreboardScore packet = new PacketPlayOutScoreboardScore(remove ? Action.a : Action.b, objective.getName(), name, score); - - playerHandle.b.a(packet); - } -} \ No newline at end of file diff --git a/NovaCore-Spigot_v1_18_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R1/VersionIndependentUtilsImplementation.java b/NovaCore-Spigot_v1_18_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R1/VersionIndependentUtilsImplementation.java index c3e56cb..e96660d 100644 --- a/NovaCore-Spigot_v1_18_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R1/VersionIndependentUtilsImplementation.java +++ b/NovaCore-Spigot_v1_18_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R1/VersionIndependentUtilsImplementation.java @@ -18,7 +18,6 @@ import net.novauniverse.novacore1_17plus.shared.DyeColorToMaterialMapper_1_17; import net.zeeraa.novacore.commons.utils.ListUtils; import net.zeeraa.novacore.spigot.abstraction.ChunkLoader; -import net.zeeraa.novacore.spigot.abstraction.INetheriteBoard; import net.zeeraa.novacore.spigot.abstraction.ItemBuilderRecordList; import net.zeeraa.novacore.spigot.abstraction.MaterialNameList; import net.zeeraa.novacore.spigot.abstraction.VersionIndependantLoader; @@ -34,8 +33,6 @@ import net.zeeraa.novacore.spigot.abstraction.enums.VersionIndependentSound; import net.zeeraa.novacore.spigot.abstraction.log.AbstractionLogger; import net.zeeraa.novacore.spigot.abstraction.manager.CustomSpectatorManager; -import net.zeeraa.novacore.spigot.abstraction.netheriteboard.BPlayerBoard; - import org.bukkit.Bukkit; import org.bukkit.DyeColor; import org.bukkit.FluidCollisionMode; @@ -70,7 +67,6 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import org.bukkit.scoreboard.Scoreboard; import org.bukkit.util.RayTraceResult; import java.lang.reflect.Field; @@ -1089,9 +1085,4 @@ public float getBlockBlastResistance(Material material) { public GameProfile getGameProfile(Player player) { return ((CraftPlayer) player).getHandle().fp(); } - - @Override - public BPlayerBoard initPlayerBoard(INetheriteBoard netheriteBoard, Player player, Scoreboard scoreboard, String name) throws Exception { - return new PlayerBoardV1_18_R1(netheriteBoard, player, scoreboard, name); - } } \ No newline at end of file diff --git a/NovaCore-Spigot_v1_18_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R2/PlayerBoardV1_18_R2.java b/NovaCore-Spigot_v1_18_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R2/PlayerBoardV1_18_R2.java deleted file mode 100644 index f964ba1..0000000 --- a/NovaCore-Spigot_v1_18_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R2/PlayerBoardV1_18_R2.java +++ /dev/null @@ -1,84 +0,0 @@ -package net.zeeraa.novacore.spigot.version.v1_18_R2; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_18_R2.scoreboard.CraftScoreboard; -import org.bukkit.entity.Player; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Scoreboard; - -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardDisplayObjective; -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardObjective; -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardScore; -import net.minecraft.server.ScoreboardServer.Action; -import net.minecraft.server.level.EntityPlayer; -import net.minecraft.world.scores.ScoreboardObjective; -import net.minecraft.world.scores.ScoreboardScore; -import net.zeeraa.novacore.commons.utils.ReflectUtils; -import net.zeeraa.novacore.spigot.abstraction.INetheriteBoard; -import net.zeeraa.novacore.spigot.abstraction.enums.ObjectiveMode; -import net.zeeraa.novacore.spigot.abstraction.netheriteboard.BPlayerBoard; - -public class PlayerBoardV1_18_R2 extends BPlayerBoard { - private EntityPlayer playerHandle; - private Field playerScoreField; - - public PlayerBoardV1_18_R2(INetheriteBoard netheriteBoard, Player player, String name) throws Exception { - this(netheriteBoard, player, null, name); - } - - public PlayerBoardV1_18_R2(INetheriteBoard netheriteBoard, Player player, Scoreboard scoreboard, String name) throws Exception { - super(netheriteBoard, player, scoreboard, name); - playerHandle = ((CraftPlayer) player).getHandle(); - - playerScoreField = net.minecraft.world.scores.Scoreboard.class.getDeclaredField("j"); - playerScoreField.setAccessible(true); - - this.init(); - } - - @Override - protected void sendObjective(Objective objective, ObjectiveMode mode) throws Exception { - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - PacketPlayOutScoreboardObjective packet = new PacketPlayOutScoreboardObjective(nmsObjective, mode.ordinal()); - playerHandle.b.a(packet); - } - - @Override - protected void sendObjectiveDisplay(Objective objective) throws Exception { - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - PacketPlayOutScoreboardDisplayObjective packet = new PacketPlayOutScoreboardDisplayObjective(1, nmsObjective); - playerHandle.b.a(packet); - } - - @Override - protected void sendScore(Objective objective, String name, int score, boolean remove) throws Exception { - net.minecraft.world.scores.Scoreboard nmsScoreboard = ((CraftScoreboard) this.scoreboard).getHandle(); - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - - ScoreboardScore scoreboardScore = new ScoreboardScore(nmsScoreboard, nmsObjective, name); - scoreboardScore.b(score); - - @SuppressWarnings("unchecked") - Map> scores = (Map>) playerScoreField.get(nmsScoreboard); - - if (remove) { - if (scores.containsKey(name)) { - scores.get(name).remove(nmsObjective); - } - } else { - if (!scores.containsKey(name)) { - scores.put(name, new HashMap<>()); - } - - scores.get(name).put(nmsObjective, scoreboardScore); - } - - PacketPlayOutScoreboardScore packet = new PacketPlayOutScoreboardScore(remove ? Action.a : Action.b, objective.getName(), name, score); - - playerHandle.b.a(packet); - } -} \ No newline at end of file diff --git a/NovaCore-Spigot_v1_18_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R2/VersionIndependentUtilsImplementation.java b/NovaCore-Spigot_v1_18_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R2/VersionIndependentUtilsImplementation.java index 2d482bf..c615b94 100644 --- a/NovaCore-Spigot_v1_18_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R2/VersionIndependentUtilsImplementation.java +++ b/NovaCore-Spigot_v1_18_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_18_R2/VersionIndependentUtilsImplementation.java @@ -17,7 +17,6 @@ import net.novauniverse.novacore1_17plus.shared.DyeColorToMaterialMapper_1_17; import net.zeeraa.novacore.commons.utils.ListUtils; import net.zeeraa.novacore.spigot.abstraction.ChunkLoader; -import net.zeeraa.novacore.spigot.abstraction.INetheriteBoard; import net.zeeraa.novacore.spigot.abstraction.ItemBuilderRecordList; import net.zeeraa.novacore.spigot.abstraction.MaterialNameList; import net.zeeraa.novacore.spigot.abstraction.VersionIndependentItems; @@ -40,7 +39,6 @@ import net.zeeraa.novacore.spigot.abstraction.commons.EntityBoundingBox; import net.zeeraa.novacore.spigot.abstraction.log.AbstractionLogger; import net.zeeraa.novacore.spigot.abstraction.manager.CustomSpectatorManager; -import net.zeeraa.novacore.spigot.abstraction.netheriteboard.BPlayerBoard; import org.bukkit.attribute.Attribute; import org.bukkit.attribute.AttributeModifier; @@ -71,7 +69,6 @@ import net.minecraft.server.MinecraftServer; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import org.bukkit.scoreboard.Scoreboard; import org.bukkit.util.RayTraceResult; import java.text.DecimalFormat; @@ -1073,9 +1070,4 @@ public float getBlockBlastResistance(Material material) { public GameProfile getGameProfile(Player player) { return ((CraftPlayer) player).getHandle().fq(); } - - @Override - public BPlayerBoard initPlayerBoard(INetheriteBoard netheriteBoard, Player player, Scoreboard scoreboard, String name) throws Exception { - return new PlayerBoardV1_18_R2(netheriteBoard, player, scoreboard, name); - } } \ No newline at end of file diff --git a/NovaCore-Spigot_v1_19_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R1/PlayerBoardV1_19_R1.java b/NovaCore-Spigot_v1_19_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R1/PlayerBoardV1_19_R1.java deleted file mode 100644 index 03230c7..0000000 --- a/NovaCore-Spigot_v1_19_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R1/PlayerBoardV1_19_R1.java +++ /dev/null @@ -1,84 +0,0 @@ -package net.zeeraa.novacore.spigot.version.v1_19_R1; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_19_R1.scoreboard.CraftScoreboard; -import org.bukkit.entity.Player; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Scoreboard; - -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardDisplayObjective; -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardObjective; -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardScore; -import net.minecraft.server.ScoreboardServer.Action; -import net.minecraft.server.level.EntityPlayer; -import net.minecraft.world.scores.ScoreboardObjective; -import net.minecraft.world.scores.ScoreboardScore; -import net.zeeraa.novacore.commons.utils.ReflectUtils; -import net.zeeraa.novacore.spigot.abstraction.INetheriteBoard; -import net.zeeraa.novacore.spigot.abstraction.enums.ObjectiveMode; -import net.zeeraa.novacore.spigot.abstraction.netheriteboard.BPlayerBoard; - -public class PlayerBoardV1_19_R1 extends BPlayerBoard { - private EntityPlayer playerHandle; - private Field playerScoreField; - - public PlayerBoardV1_19_R1(INetheriteBoard netheriteBoard, Player player, String name) throws Exception { - this(netheriteBoard, player, null, name); - } - - public PlayerBoardV1_19_R1(INetheriteBoard netheriteBoard, Player player, Scoreboard scoreboard, String name) throws Exception { - super(netheriteBoard, player, scoreboard, name); - playerHandle = ((CraftPlayer) player).getHandle(); - - playerScoreField = net.minecraft.world.scores.Scoreboard.class.getDeclaredField("j"); - playerScoreField.setAccessible(true); - - this.init(); - } - - @Override - protected void sendObjective(Objective objective, ObjectiveMode mode) throws Exception { - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - PacketPlayOutScoreboardObjective packet = new PacketPlayOutScoreboardObjective(nmsObjective, mode.ordinal()); - playerHandle.b.a(packet); - } - - @Override - protected void sendObjectiveDisplay(Objective objective) throws Exception { - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - PacketPlayOutScoreboardDisplayObjective packet = new PacketPlayOutScoreboardDisplayObjective(1, nmsObjective); - playerHandle.b.a(packet); - } - - @Override - protected void sendScore(Objective objective, String name, int score, boolean remove) throws Exception { - net.minecraft.world.scores.Scoreboard nmsScoreboard = ((CraftScoreboard) this.scoreboard).getHandle(); - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - - ScoreboardScore scoreboardScore = new ScoreboardScore(nmsScoreboard, nmsObjective, name); - scoreboardScore.b(score); - - @SuppressWarnings("unchecked") - Map> scores = (Map>) playerScoreField.get(nmsScoreboard); - - if (remove) { - if (scores.containsKey(name)) { - scores.get(name).remove(nmsObjective); - } - } else { - if (!scores.containsKey(name)) { - scores.put(name, new HashMap<>()); - } - - scores.get(name).put(nmsObjective, scoreboardScore); - } - - PacketPlayOutScoreboardScore packet = new PacketPlayOutScoreboardScore(remove ? Action.a : Action.b, objective.getName(), name, score); - - playerHandle.b.a(packet); - } -} \ No newline at end of file diff --git a/NovaCore-Spigot_v1_19_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R1/VersionIndependentUtilsImplementation.java b/NovaCore-Spigot_v1_19_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R1/VersionIndependentUtilsImplementation.java index ce19a53..f6a2108 100644 --- a/NovaCore-Spigot_v1_19_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R1/VersionIndependentUtilsImplementation.java +++ b/NovaCore-Spigot_v1_19_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R1/VersionIndependentUtilsImplementation.java @@ -18,7 +18,6 @@ import net.novauniverse.spigot.version.shared.v1_16plus.SharedBannerItemStackCreator; import net.zeeraa.novacore.commons.utils.ListUtils; import net.zeeraa.novacore.spigot.abstraction.ChunkLoader; -import net.zeeraa.novacore.spigot.abstraction.INetheriteBoard; import net.zeeraa.novacore.spigot.abstraction.ItemBuilderRecordList; import net.zeeraa.novacore.spigot.abstraction.MaterialNameList; import net.zeeraa.novacore.spigot.abstraction.VersionIndependentItems; @@ -41,8 +40,6 @@ import net.zeeraa.novacore.spigot.abstraction.commons.EntityBoundingBox; import net.zeeraa.novacore.spigot.abstraction.log.AbstractionLogger; import net.zeeraa.novacore.spigot.abstraction.manager.CustomSpectatorManager; -import net.zeeraa.novacore.spigot.abstraction.netheriteboard.BPlayerBoard; - import org.bukkit.attribute.Attribute; import org.bukkit.attribute.AttributeModifier; import org.bukkit.block.Block; @@ -72,7 +69,6 @@ import net.minecraft.server.MinecraftServer; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import org.bukkit.scoreboard.Scoreboard; import org.bukkit.util.RayTraceResult; import java.text.DecimalFormat; @@ -1075,9 +1071,4 @@ public float getBlockBlastResistance(Material material) { public GameProfile getGameProfile(Player player) { return ((CraftPlayer) player).getHandle().fz(); } - - @Override - public BPlayerBoard initPlayerBoard(INetheriteBoard netheriteBoard, Player player, Scoreboard scoreboard, String name) throws Exception { - return new PlayerBoardV1_19_R1(netheriteBoard, player, scoreboard, name); - } } \ No newline at end of file diff --git a/NovaCore-Spigot_v1_19_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R2/PlayerBoardV1_19_R2.java b/NovaCore-Spigot_v1_19_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R2/PlayerBoardV1_19_R2.java deleted file mode 100644 index 2df6b6f..0000000 --- a/NovaCore-Spigot_v1_19_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R2/PlayerBoardV1_19_R2.java +++ /dev/null @@ -1,84 +0,0 @@ -package net.zeeraa.novacore.spigot.version.v1_19_R2; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_19_R2.scoreboard.CraftScoreboard; -import org.bukkit.entity.Player; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Scoreboard; - -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardDisplayObjective; -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardObjective; -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardScore; -import net.minecraft.server.ScoreboardServer.Action; -import net.minecraft.server.level.EntityPlayer; -import net.minecraft.world.scores.ScoreboardObjective; -import net.minecraft.world.scores.ScoreboardScore; -import net.zeeraa.novacore.commons.utils.ReflectUtils; -import net.zeeraa.novacore.spigot.abstraction.INetheriteBoard; -import net.zeeraa.novacore.spigot.abstraction.enums.ObjectiveMode; -import net.zeeraa.novacore.spigot.abstraction.netheriteboard.BPlayerBoard; - -public class PlayerBoardV1_19_R2 extends BPlayerBoard { - private EntityPlayer playerHandle; - private Field playerScoreField; - - public PlayerBoardV1_19_R2(INetheriteBoard netheriteBoard, Player player, String name) throws Exception { - this(netheriteBoard, player, null, name); - } - - public PlayerBoardV1_19_R2(INetheriteBoard netheriteBoard, Player player, Scoreboard scoreboard, String name) throws Exception { - super(netheriteBoard, player, scoreboard, name); - playerHandle = ((CraftPlayer) player).getHandle(); - - playerScoreField = net.minecraft.world.scores.Scoreboard.class.getDeclaredField("j"); - playerScoreField.setAccessible(true); - - this.init(); - } - - @Override - protected void sendObjective(Objective objective, ObjectiveMode mode) throws Exception { - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - PacketPlayOutScoreboardObjective packet = new PacketPlayOutScoreboardObjective(nmsObjective, mode.ordinal()); - playerHandle.b.a(packet); - } - - @Override - protected void sendObjectiveDisplay(Objective objective) throws Exception { - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - PacketPlayOutScoreboardDisplayObjective packet = new PacketPlayOutScoreboardDisplayObjective(1, nmsObjective); - playerHandle.b.a(packet); - } - - @Override - protected void sendScore(Objective objective, String name, int score, boolean remove) throws Exception { - net.minecraft.world.scores.Scoreboard nmsScoreboard = ((CraftScoreboard) this.scoreboard).getHandle(); - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - - ScoreboardScore scoreboardScore = new ScoreboardScore(nmsScoreboard, nmsObjective, name); - scoreboardScore.b(score); - - @SuppressWarnings("unchecked") - Map> scores = (Map>) playerScoreField.get(nmsScoreboard); - - if (remove) { - if (scores.containsKey(name)) { - scores.get(name).remove(nmsObjective); - } - } else { - if (!scores.containsKey(name)) { - scores.put(name, new HashMap<>()); - } - - scores.get(name).put(nmsObjective, scoreboardScore); - } - - PacketPlayOutScoreboardScore packet = new PacketPlayOutScoreboardScore(remove ? Action.a : Action.b, objective.getName(), name, score); - - playerHandle.b.a(packet); - } -} \ No newline at end of file diff --git a/NovaCore-Spigot_v1_19_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R2/VersionIndependentUtilsImplementation.java b/NovaCore-Spigot_v1_19_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R2/VersionIndependentUtilsImplementation.java index 1190f3f..4d69280 100644 --- a/NovaCore-Spigot_v1_19_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R2/VersionIndependentUtilsImplementation.java +++ b/NovaCore-Spigot_v1_19_R2/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R2/VersionIndependentUtilsImplementation.java @@ -44,7 +44,6 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import org.bukkit.scoreboard.Scoreboard; import org.bukkit.util.RayTraceResult; import com.mojang.authlib.GameProfile; @@ -65,7 +64,6 @@ import net.novauniverse.novacore1_17plus.shared.DyeColorToMaterialMapper_1_17; import net.zeeraa.novacore.commons.utils.ListUtils; import net.zeeraa.novacore.spigot.abstraction.ChunkLoader; -import net.zeeraa.novacore.spigot.abstraction.INetheriteBoard; import net.zeeraa.novacore.spigot.abstraction.ItemBuilderRecordList; import net.zeeraa.novacore.spigot.abstraction.MaterialNameList; import net.zeeraa.novacore.spigot.abstraction.VersionIndependentItems; @@ -80,7 +78,6 @@ import net.zeeraa.novacore.spigot.abstraction.enums.VersionIndependentSound; import net.zeeraa.novacore.spigot.abstraction.log.AbstractionLogger; import net.zeeraa.novacore.spigot.abstraction.manager.CustomSpectatorManager; -import net.zeeraa.novacore.spigot.abstraction.netheriteboard.BPlayerBoard; public class VersionIndependentUtilsImplementation extends BaseVersionIndependentUtilImplementation1_17Plus { private ItemBuilderRecordList itemBuilderRecordList; @@ -1079,9 +1076,4 @@ public float getBlockBlastResistance(Material material) { public GameProfile getGameProfile(Player player) { return ((CraftPlayer) player).getHandle().fD(); } - - @Override - public BPlayerBoard initPlayerBoard(INetheriteBoard netheriteBoard, Player player, Scoreboard scoreboard, String name) throws Exception { - return new PlayerBoardV1_19_R2(netheriteBoard, player, scoreboard, name); - } } \ No newline at end of file diff --git a/NovaCore-Spigot_v1_19_R3/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R3/PlayerBoardV1_19_R3.java b/NovaCore-Spigot_v1_19_R3/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R3/PlayerBoardV1_19_R3.java deleted file mode 100644 index 54317f4..0000000 --- a/NovaCore-Spigot_v1_19_R3/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R3/PlayerBoardV1_19_R3.java +++ /dev/null @@ -1,84 +0,0 @@ -package net.zeeraa.novacore.spigot.version.v1_19_R3; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -import org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_19_R3.scoreboard.CraftScoreboard; -import org.bukkit.entity.Player; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Scoreboard; - -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardDisplayObjective; -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardObjective; -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardScore; -import net.minecraft.server.ScoreboardServer.Action; -import net.minecraft.server.level.EntityPlayer; -import net.minecraft.world.scores.ScoreboardObjective; -import net.minecraft.world.scores.ScoreboardScore; -import net.zeeraa.novacore.commons.utils.ReflectUtils; -import net.zeeraa.novacore.spigot.abstraction.INetheriteBoard; -import net.zeeraa.novacore.spigot.abstraction.enums.ObjectiveMode; -import net.zeeraa.novacore.spigot.abstraction.netheriteboard.BPlayerBoard; - -public class PlayerBoardV1_19_R3 extends BPlayerBoard { - private EntityPlayer playerHandle; - private Field playerScoreField; - - public PlayerBoardV1_19_R3(INetheriteBoard netheriteBoard, Player player, String name) throws Exception { - this(netheriteBoard, player, null, name); - } - - public PlayerBoardV1_19_R3(INetheriteBoard netheriteBoard, Player player, Scoreboard scoreboard, String name) throws Exception { - super(netheriteBoard, player, scoreboard, name); - playerHandle = ((CraftPlayer) player).getHandle(); - - playerScoreField = net.minecraft.world.scores.Scoreboard.class.getDeclaredField("j"); - playerScoreField.setAccessible(true); - - this.init(); - } - - @Override - protected void sendObjective(Objective objective, ObjectiveMode mode) throws Exception { - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - PacketPlayOutScoreboardObjective packet = new PacketPlayOutScoreboardObjective(nmsObjective, mode.ordinal()); - playerHandle.b.a(packet); - } - - @Override - protected void sendObjectiveDisplay(Objective objective) throws Exception { - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - PacketPlayOutScoreboardDisplayObjective packet = new PacketPlayOutScoreboardDisplayObjective(1, nmsObjective); - playerHandle.b.a(packet); - } - - @Override - protected void sendScore(Objective objective, String name, int score, boolean remove) throws Exception { - net.minecraft.world.scores.Scoreboard nmsScoreboard = ((CraftScoreboard) this.scoreboard).getHandle(); - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - - ScoreboardScore scoreboardScore = new ScoreboardScore(nmsScoreboard, nmsObjective, name); - scoreboardScore.b(score); - - @SuppressWarnings("unchecked") - Map> scores = (Map>) playerScoreField.get(nmsScoreboard); - - if (remove) { - if (scores.containsKey(name)) { - scores.get(name).remove(nmsObjective); - } - } else { - if (!scores.containsKey(name)) { - scores.put(name, new HashMap<>()); - } - - scores.get(name).put(nmsObjective, scoreboardScore); - } - - PacketPlayOutScoreboardScore packet = new PacketPlayOutScoreboardScore(remove ? Action.a : Action.b, objective.getName(), name, score); - - playerHandle.b.a(packet); - } -} \ No newline at end of file diff --git a/NovaCore-Spigot_v1_19_R3/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R3/VersionIndependentUtilsImplementation.java b/NovaCore-Spigot_v1_19_R3/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R3/VersionIndependentUtilsImplementation.java index e2780cd..b1d92a6 100644 --- a/NovaCore-Spigot_v1_19_R3/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R3/VersionIndependentUtilsImplementation.java +++ b/NovaCore-Spigot_v1_19_R3/src/main/java/net/zeeraa/novacore/spigot/version/v1_19_R3/VersionIndependentUtilsImplementation.java @@ -43,7 +43,6 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import org.bukkit.scoreboard.Scoreboard; import org.bukkit.util.RayTraceResult; import com.mojang.authlib.GameProfile; @@ -64,7 +63,6 @@ import net.novauniverse.novacore1_17plus.shared.DyeColorToMaterialMapper_1_17; import net.zeeraa.novacore.commons.utils.ListUtils; import net.zeeraa.novacore.spigot.abstraction.ChunkLoader; -import net.zeeraa.novacore.spigot.abstraction.INetheriteBoard; import net.zeeraa.novacore.spigot.abstraction.ItemBuilderRecordList; import net.zeeraa.novacore.spigot.abstraction.MaterialNameList; import net.zeeraa.novacore.spigot.abstraction.VersionIndependentItems; @@ -79,7 +77,6 @@ import net.zeeraa.novacore.spigot.abstraction.enums.VersionIndependentSound; import net.zeeraa.novacore.spigot.abstraction.log.AbstractionLogger; import net.zeeraa.novacore.spigot.abstraction.manager.CustomSpectatorManager; -import net.zeeraa.novacore.spigot.abstraction.netheriteboard.BPlayerBoard; public class VersionIndependentUtilsImplementation extends BaseVersionIndependentUtilImplementation1_17Plus { private ItemBuilderRecordList itemBuilderRecordList; @@ -1069,9 +1066,4 @@ public float getBlockBlastResistance(Material material) { public GameProfile getGameProfile(Player player) { return ((CraftPlayer) player).getHandle().fI(); } - - @Override - public BPlayerBoard initPlayerBoard(INetheriteBoard netheriteBoard, Player player, Scoreboard scoreboard, String name) throws Exception { - return new PlayerBoardV1_19_R3(netheriteBoard, player, scoreboard, name); - } } \ No newline at end of file diff --git a/NovaCore-Spigot_v1_20_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_20_R1/PlayerBoardV1_20_R1.java b/NovaCore-Spigot_v1_20_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_20_R1/PlayerBoardV1_20_R1.java deleted file mode 100644 index ee5e5f0..0000000 --- a/NovaCore-Spigot_v1_20_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_20_R1/PlayerBoardV1_20_R1.java +++ /dev/null @@ -1,84 +0,0 @@ -package net.zeeraa.novacore.spigot.version.v1_20_R1; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_20_R1.scoreboard.CraftScoreboard; -import org.bukkit.entity.Player; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Scoreboard; - -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardDisplayObjective; -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardObjective; -import net.minecraft.network.protocol.game.PacketPlayOutScoreboardScore; -import net.minecraft.server.ScoreboardServer.Action; -import net.minecraft.server.level.EntityPlayer; -import net.minecraft.world.scores.ScoreboardObjective; -import net.minecraft.world.scores.ScoreboardScore; -import net.zeeraa.novacore.commons.utils.ReflectUtils; -import net.zeeraa.novacore.spigot.abstraction.INetheriteBoard; -import net.zeeraa.novacore.spigot.abstraction.enums.ObjectiveMode; -import net.zeeraa.novacore.spigot.abstraction.netheriteboard.BPlayerBoard; - -public class PlayerBoardV1_20_R1 extends BPlayerBoard { - private EntityPlayer playerHandle; - private Field playerScoreField; - - public PlayerBoardV1_20_R1(INetheriteBoard netheriteBoard, Player player, String name) throws Exception { - this(netheriteBoard, player, null, name); - } - - public PlayerBoardV1_20_R1(INetheriteBoard netheriteBoard, Player player, Scoreboard scoreboard, String name) throws Exception { - super(netheriteBoard, player, scoreboard, name); - playerHandle = ((CraftPlayer) player).getHandle(); - - playerScoreField = net.minecraft.world.scores.Scoreboard.class.getDeclaredField("j"); - playerScoreField.setAccessible(true); - - this.init(); - } - - @Override - protected void sendObjective(Objective objective, ObjectiveMode mode) throws Exception { - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - PacketPlayOutScoreboardObjective packet = new PacketPlayOutScoreboardObjective(nmsObjective, mode.ordinal()); - playerHandle.c.a(packet); - } - - @Override - protected void sendObjectiveDisplay(Objective objective) throws Exception { - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - PacketPlayOutScoreboardDisplayObjective packet = new PacketPlayOutScoreboardDisplayObjective(1, nmsObjective); - playerHandle.c.a(packet); - } - - @Override - protected void sendScore(Objective objective, String name, int score, boolean remove) throws Exception { - net.minecraft.world.scores.Scoreboard nmsScoreboard = ((CraftScoreboard) this.scoreboard).getHandle(); - ScoreboardObjective nmsObjective = (ScoreboardObjective) ReflectUtils.getHandle(objective); - - ScoreboardScore scoreboardScore = new ScoreboardScore(nmsScoreboard, nmsObjective, name); - scoreboardScore.b(score); - - @SuppressWarnings("unchecked") - Map> scores = (Map>) playerScoreField.get(nmsScoreboard); - - if (remove) { - if (scores.containsKey(name)) { - scores.get(name).remove(nmsObjective); - } - } else { - if (!scores.containsKey(name)) { - scores.put(name, new HashMap<>()); - } - - scores.get(name).put(nmsObjective, scoreboardScore); - } - - PacketPlayOutScoreboardScore packet = new PacketPlayOutScoreboardScore(remove ? Action.a : Action.b, objective.getName(), name, score); - - playerHandle.c.a(packet); - } -} \ No newline at end of file diff --git a/NovaCore-Spigot_v1_20_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_20_R1/VersionIndependentUtilsImplementation.java b/NovaCore-Spigot_v1_20_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_20_R1/VersionIndependentUtilsImplementation.java index 19674ea..b33367b 100644 --- a/NovaCore-Spigot_v1_20_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_20_R1/VersionIndependentUtilsImplementation.java +++ b/NovaCore-Spigot_v1_20_R1/src/main/java/net/zeeraa/novacore/spigot/version/v1_20_R1/VersionIndependentUtilsImplementation.java @@ -43,7 +43,6 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import org.bukkit.scoreboard.Scoreboard; import org.bukkit.util.RayTraceResult; import com.mojang.authlib.GameProfile; @@ -64,7 +63,6 @@ import net.novauniverse.novacore1_17plus.shared.DyeColorToMaterialMapper_1_17; import net.zeeraa.novacore.commons.utils.ListUtils; import net.zeeraa.novacore.spigot.abstraction.ChunkLoader; -import net.zeeraa.novacore.spigot.abstraction.INetheriteBoard; import net.zeeraa.novacore.spigot.abstraction.ItemBuilderRecordList; import net.zeeraa.novacore.spigot.abstraction.MaterialNameList; import net.zeeraa.novacore.spigot.abstraction.VersionIndependentItems; @@ -79,7 +77,6 @@ import net.zeeraa.novacore.spigot.abstraction.enums.VersionIndependentSound; import net.zeeraa.novacore.spigot.abstraction.log.AbstractionLogger; import net.zeeraa.novacore.spigot.abstraction.manager.CustomSpectatorManager; -import net.zeeraa.novacore.spigot.abstraction.netheriteboard.BPlayerBoard; public class VersionIndependentUtilsImplementation extends BaseVersionIndependentUtilImplementation1_17Plus { private ItemBuilderRecordList itemBuilderRecordList; @@ -1069,9 +1066,4 @@ public float getBlockBlastResistance(Material material) { public GameProfile getGameProfile(Player player) { return ((CraftPlayer) player).getHandle().fM(); } - - @Override - public BPlayerBoard initPlayerBoard(INetheriteBoard netheriteBoard, Player player, Scoreboard scoreboard, String name) throws Exception { - return new PlayerBoardV1_20_R1(netheriteBoard, player, scoreboard, name); - } } \ No newline at end of file