From d181f398546be4c4d571fc4070e470300a53c69d Mon Sep 17 00:00:00 2001 From: DevDrizzy Date: Fri, 15 Mar 2024 23:24:40 +0500 Subject: [PATCH] Fixed compile errors Signed-off-by: DevDrizzy --- pom.xml | 25 ++-- .../refinedev/api/nametag/NameTagHandler.java | 1 - .../packet/wrapper/WrappedScoreboardTeam.java | 129 ------------------ .../api/nametag/setup/NameTagTeam.java | 4 - 4 files changed, 13 insertions(+), 146 deletions(-) delete mode 100644 src/main/java/xyz/refinedev/api/nametag/packet/wrapper/WrappedScoreboardTeam.java diff --git a/pom.xml b/pom.xml index e164fc9..1e8a982 100644 --- a/pom.xml +++ b/pom.xml @@ -68,24 +68,25 @@ + + + org.spigotmc + spigot-api + ${spigot.version} + provided + + + org.spigotmc + spigot + ${spigot.version} + provided + org.paperspigot PaperSpigot 1.8.8 provided - - - - - - - - - - - - diff --git a/src/main/java/xyz/refinedev/api/nametag/NameTagHandler.java b/src/main/java/xyz/refinedev/api/nametag/NameTagHandler.java index f9f1667..167b9dc 100644 --- a/src/main/java/xyz/refinedev/api/nametag/NameTagHandler.java +++ b/src/main/java/xyz/refinedev/api/nametag/NameTagHandler.java @@ -35,7 +35,6 @@ import xyz.refinedev.api.nametag.util.VersionUtil; import java.util.*; -import java.util.concurrent.ConcurrentHashMap; /** * This Project is property of Refine Development. diff --git a/src/main/java/xyz/refinedev/api/nametag/packet/wrapper/WrappedScoreboardTeam.java b/src/main/java/xyz/refinedev/api/nametag/packet/wrapper/WrappedScoreboardTeam.java deleted file mode 100644 index 1f2ccb2..0000000 --- a/src/main/java/xyz/refinedev/api/nametag/packet/wrapper/WrappedScoreboardTeam.java +++ /dev/null @@ -1,129 +0,0 @@ -package xyz.refinedev.api.nametag.packet.wrapper; - -import com.comphenix.protocol.reflect.ExactReflection; -import org.bukkit.ChatColor; - -import com.comphenix.protocol.reflect.accessors.Accessors; -import com.comphenix.protocol.reflect.accessors.FieldAccessor; -import com.comphenix.protocol.utility.MinecraftReflection; -import com.comphenix.protocol.wrappers.AbstractWrapper; -import com.comphenix.protocol.wrappers.EnumWrappers; -import com.comphenix.protocol.wrappers.EnumWrappers.IndexedEnumConverter; -import com.comphenix.protocol.wrappers.WrappedChatComponent; - -/** - * Taken from GitHub: Click Here - */ -public class WrappedScoreboardTeam extends AbstractWrapper { - - private static final FieldAccessor DISPLAY_NAME = Accessors - .getFieldAccessor(ExactReflection.fromClass(MinecraftReflection.getMinecraftClass("network.protocol.game.PacketPlayOutScoreboardTeam$b"), true).findField("a")); - private static final FieldAccessor PREFIX = Accessors - .getFieldAccessor(ExactReflection.fromClass(MinecraftReflection.getMinecraftClass("network.protocol.game.PacketPlayOutScoreboardTeam$b"), true).findField("b")); - private static final FieldAccessor SUFFIX = Accessors - .getFieldAccessor(ExactReflection.fromClass(MinecraftReflection.getMinecraftClass("network.protocol.game.PacketPlayOutScoreboardTeam$b"), true).findField("c")); - private static final FieldAccessor NAME_TAG_VISIBILITY = Accessors - .getFieldAccessor(ExactReflection.fromClass(MinecraftReflection.getMinecraftClass("network.protocol.game.PacketPlayOutScoreboardTeam$b"), true).findField("d")); - private static final FieldAccessor COLLISION_RULE = Accessors - .getFieldAccessor(ExactReflection.fromClass(MinecraftReflection.getMinecraftClass("network.protocol.game.PacketPlayOutScoreboardTeam$b"), true).findField("e")); - private static final FieldAccessor TEAM_COLOR = Accessors - .getFieldAccessor(ExactReflection.fromClass(MinecraftReflection.getMinecraftClass("network.protocol.game.PacketPlayOutScoreboardTeam$b"), true).findField("f")); - private static final FieldAccessor FRIENDLY_FLAGS = Accessors - .getFieldAccessor(ExactReflection.fromClass(MinecraftReflection.getMinecraftClass("network.protocol.game.PacketPlayOutScoreboardTeam$b"), true).findField("g")); - - private static final Class ENUM_CHAT_FORMAT_CLASS = MinecraftReflection.getMinecraftClass("EnumChatFormat"); - private static final IndexedEnumConverter CHATCOLOR_CONVERTER = new IndexedEnumConverter<>(ChatColor.class, ENUM_CHAT_FORMAT_CLASS); - - private WrappedScoreboardTeam(Object handle) { - super(MinecraftReflection.getMinecraftClass("network.protocol.game.PacketPlayOutScoreboardTeam$b")); - setHandle(handle); - } - - public static WrappedScoreboardTeam fromHandle(Object handle) { - return new WrappedScoreboardTeam(handle); - } - - public WrappedChatComponent getDisplayName() { - return WrappedChatComponent.fromHandle(DISPLAY_NAME.get(this.handle)); - } - - public void setDisplayName(WrappedChatComponent displayName) { - DISPLAY_NAME.set(this.handle, displayName.getHandle()); - } - - public WrappedChatComponent getPrefix() { - return WrappedChatComponent.fromHandle(PREFIX.get(this.handle)); - } - - public void setPrefix(WrappedChatComponent prefix) { - PREFIX.set(this.handle, prefix.getHandle()); - } - - public WrappedChatComponent getSuffix() { - return WrappedChatComponent.fromHandle(SUFFIX.get(this.handle)); - } - - public void setSuffix(WrappedChatComponent suffix) { - SUFFIX.set(this.handle, suffix.getHandle()); - } - - public String getNameTagVisibility() { - return (String) NAME_TAG_VISIBILITY.get(this.handle); - } - - public void setNameTagVisibility(String value) { - NAME_TAG_VISIBILITY.set(this.handle, value); - } - - public String getCollisionRule() { - return (String) COLLISION_RULE.get(this.handle); - } - - public void setCollisionRule(String value) { - COLLISION_RULE.set(this.handle, value); - } - - public ChatColor getTeamColor() { - return ChatColor.getByChar(TEAM_COLOR.get(this.handle).toString().charAt(1)); - } - - public void setTeamColor(ChatColor value) { - if (value.isColor() || value == ChatColor.RESET) { - TEAM_COLOR.set(this.handle, CHATCOLOR_CONVERTER.getGeneric(value)); - } - } - - public boolean getFriendlyFire() { - int intValue = ((Integer) FRIENDLY_FLAGS.get(this.handle)).intValue(); - return (intValue & 0x01) == 1; - } - - public void setFriendlyFire(boolean value) { - int currentValue = ((Integer) FRIENDLY_FLAGS.get(this.handle)).intValue(); - if (getFriendlyFire() && !value) { - // is already friendly fire but should not be - FRIENDLY_FLAGS.set(this.handle, Integer.valueOf(currentValue ^ 0x01)); - } - else if (value) { - // is already friendly fire but should not be - FRIENDLY_FLAGS.set(this.handle, Integer.valueOf(currentValue | 0x01)); - } - } - - public boolean getFriendlySeeInvisible() { - int intValue = ((Integer) FRIENDLY_FLAGS.get(this.handle)).intValue(); - return (intValue & 0x02) == 2; - } - - public void setFriendlySeeInvisible(boolean value) { - int currentValue = ((Integer) FRIENDLY_FLAGS.get(this.handle)).intValue(); - if (getFriendlyFire() && !value) { - // is already friendly fire but should not be - FRIENDLY_FLAGS.set(this.handle, Integer.valueOf(currentValue ^ 0x02)); - } - else if (value) { - // is already friendly fire but should not be - FRIENDLY_FLAGS.set(this.handle, Integer.valueOf(currentValue | 0x02)); - } - } -} \ No newline at end of file diff --git a/src/main/java/xyz/refinedev/api/nametag/setup/NameTagTeam.java b/src/main/java/xyz/refinedev/api/nametag/setup/NameTagTeam.java index 237db61..e130ecf 100644 --- a/src/main/java/xyz/refinedev/api/nametag/setup/NameTagTeam.java +++ b/src/main/java/xyz/refinedev/api/nametag/setup/NameTagTeam.java @@ -48,10 +48,6 @@ public PacketWrapper getPECreatePacket() { return (PacketWrapper) createPacket; } - public ScoreboardPacket getNormalCreatePacket() { - return (ScoreboardPacket) createPacket; - } - public void destroyFor(Player player) { WrapperPlayServerTeams packet = new WrapperPlayServerTeams(name, WrapperPlayServerTeams.TeamMode.REMOVE, new WrapperPlayServerTeams.ScoreBoardTeamInfo( ColorUtil.translate(name),