From db5a4e187b1344a1137b7de964d85aa452c7bb2e Mon Sep 17 00:00:00 2001 From: Tanguygab Date: Mon, 29 Mar 2021 16:40:27 +0200 Subject: [PATCH] added support for TAB 2.8.11-pre9 --- .../tabadditions/shared/TABAdditions.java | 70 +++++-------------- .../shared/commands/TitleCmd.java | 6 +- .../shared/features/ActionBar.java | 12 +--- .../shared/features/NametagInRange.java | 14 ++-- .../tabadditions/shared/features/OnlyYou.java | 9 +-- .../shared/features/SneakHideNametag.java | 11 +-- .../shared/features/TAFeature.java | 26 +++++++ .../shared/features/TablistNamesRadius.java | 9 +-- .../tabadditions/shared/features/Title.java | 11 +-- .../shared/features/UnlimitedItemLines.java | 12 +--- .../shared/features/chat/ChatFormat.java | 1 - .../shared/features/chat/ChatManager.java | 13 ++-- .../features/layouts/LayoutManager.java | 12 ++-- .../shared/features/rfps/RFPManager.java | 10 ++- .../tabadditions/spigot/BukkitItemLine.java | 6 +- 15 files changed, 82 insertions(+), 140 deletions(-) create mode 100644 src/main/java/io/github/tanguygab/tabadditions/shared/features/TAFeature.java diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/TABAdditions.java b/src/main/java/io/github/tanguygab/tabadditions/shared/TABAdditions.java index 23d6ecc..517f8e3 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/TABAdditions.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/TABAdditions.java @@ -13,8 +13,8 @@ import me.neznamy.tab.shared.Property; import me.neznamy.tab.shared.TAB; import me.neznamy.tab.shared.config.YamlConfigurationFile; -import me.neznamy.tab.shared.cpu.TabFeature; import me.neznamy.tab.shared.features.PlaceholderManager; +import me.neznamy.tab.shared.features.types.Loadable; import me.neznamy.tab.shared.placeholders.Placeholder; import me.neznamy.tab.shared.placeholders.conditions.Condition; import org.bukkit.Bukkit; @@ -117,7 +117,7 @@ public void loadFiles() { nametagInRange = config.getInt("features.nametag-in-range", 0); tablistNamesRadius = config.getInt("features.tablist-names-radius", 0); onlyyou = config.getBoolean("features.only-you",false); - if (config.hasConfigOption("features.unlimited-item-lines") && Bukkit.getServer().getVersion().contains("1.16.5")) + if (config.hasConfigOption("features.unlimited-item-lines") && Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3].equals("v1_16_R3")) unlimitedItemLines = config.getBoolean("features.unlimited-item-lines"); } @@ -140,47 +140,11 @@ public void reload() { public void disable() { FeatureManager fm = TAB.getInstance().getFeatureManager(); - //ActionBar - fm.getFeature("ActionBar"); - - //Title - fm.unregisterFeature("Title"); - - //Chat - if (fm.isFeatureEnabled("Chat")) - ((ChatManager)fm.getFeature("Chat")).unload(); - fm.unregisterFeature("Chat"); - - //Layout - if (fm.isFeatureEnabled("TAB+ Layout")) - ((LayoutManager)fm.getFeature("TAB+ Layout")).unload(); - fm.unregisterFeature("TAB+ Layout"); - //RFP - if (fm.isFeatureEnabled("Real Fake Players")) - ((RFPManager)fm.getFeature("Real Fake Players")).unload(); - fm.unregisterFeature("Real Fake Players"); - - //Sneak Hide Nametag - fm.unregisterFeature("Sneak Hide Nametag"); - - //Nametag in Range - if (fm.isFeatureEnabled("Nametag in Range")) - ((NametagInRange)fm.getFeature("Nametag in Range")).unload(); - fm.unregisterFeature("Nametag in Range"); - - //Tablist Names Radius - if (fm.isFeatureEnabled("Tablist Names Radius")) - ((TablistNamesRadius)fm.getFeature("Tablist Names Radius")).unload(); - fm.unregisterFeature("Tablist Names Radius"); - - //Only You - if (fm.isFeatureEnabled("Only You")) - ((OnlyYou)fm.getFeature("Only You")).unload(); - fm.unregisterFeature("Only You"); - - //Unlimited Item Lines - if (unlimitedItemLines) - fm.unregisterFeature("Unlimited Item Lines"); + for (TAFeature feature : TAFeature.values()) { + if (fm.isFeatureEnabled(feature.toString()) && fm.getFeature(feature.toString()) instanceof Loadable) + ((Loadable) fm.getFeature(feature.toString())).unload(); + fm.unregisterFeature(feature.toString()); + } enabled = false; TAB.getInstance().unload(); @@ -200,34 +164,34 @@ private void loadFeatures() { FeatureManager fm = TAB.getInstance().getFeatureManager(); //ActionBar if (actionbarsEnabled) - fm.registerFeature("ActionBar", new ActionBar(TabFeature.ADDON_FEATURE_1)); + fm.registerFeature(TAFeature.ACTIONBAR.toString(), new ActionBar()); //Title if (titlesEnabled) - fm.registerFeature("Title", new Title(TabFeature.ADDON_FEATURE_2)); + fm.registerFeature(TAFeature.TITLE.toString(), new Title()); //Chat if (chatEnabled) - fm.registerFeature("Chat", new ChatManager(TabFeature.ADDON_FEATURE_3)); + fm.registerFeature(TAFeature.CHAT.toString(), new ChatManager()); //Layout if (layoutEnabled && TAB.getInstance().isPremium()) - fm.registerFeature("TAB+ Layout",new LayoutManager(TabFeature.ADDON_FEATURE_4)); + fm.registerFeature(TAFeature.TA_LAYOUT.toString(), new LayoutManager()); //RFP if (rfpEnabled) - fm.registerFeature("Real Fake Players",new RFPManager(TabFeature.ADDON_FEATURE_5)); + fm.registerFeature(TAFeature.RFP.toString(), new RFPManager()); //Sneak Hide Nametag if (sneakhideEnabled) - fm.registerFeature("Sneak Hide Nametag", new SneakHideNametag(TabFeature.ADDON_FEATURE_6)); + fm.registerFeature(TAFeature.SNEAK_HIDE_NAMETAG.toString(), new SneakHideNametag()); //Nametag in Range if (nametagInRange != 0) - fm.registerFeature("Nametag in Range",new NametagInRange(TabFeature.ADDON_FEATURE_7)); + fm.registerFeature(TAFeature.NAMETAG_IN_RANGE.toString(), new NametagInRange()); //Tablist Names Radius if (tablistNamesRadius != 0) - fm.registerFeature("Tablist Names Radius",new TablistNamesRadius(TabFeature.ADDON_FEATURE_8)); + fm.registerFeature(TAFeature.TABLIST_NAMES_RADIUS.toString(), new TablistNamesRadius()); //Only You if (onlyyou) - fm.registerFeature("Only You",new OnlyYou(TabFeature.ADDON_FEATURE_9)); + fm.registerFeature(TAFeature.ONLY_YOU.toString(), new OnlyYou()); //Unlimited Item Lines if (TAB.getInstance().getFeatureManager().isFeatureEnabled("nametagx") && unlimitedItemLines) - fm.registerFeature("Unlimited Item Lines",new UnlimitedItemLines(TabFeature.ADDON_FEATURE_10)); + fm.registerFeature(TAFeature.UNLIMITED_ITEM_LINES.toString(), new UnlimitedItemLines()); } private void loadPlaceholders() { diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/commands/TitleCmd.java b/src/main/java/io/github/tanguygab/tabadditions/shared/commands/TitleCmd.java index dbe421e..55b100b 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/commands/TitleCmd.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/commands/TitleCmd.java @@ -30,9 +30,9 @@ else if (!name.equals("~Console~")) } title = instance.parsePlaceholders(title,p); subtitle = instance.parsePlaceholders(subtitle,p); - p.sendCustomPacket(PacketPlayOutTitle.TITLE(title)); - p.sendCustomPacket(PacketPlayOutTitle.SUBTITLE(subtitle)); - p.sendCustomPacket(PacketPlayOutTitle.TIMES(fadeIn,stay,fadeOut)); + p.sendCustomPacket(PacketPlayOutTitle.title(title)); + p.sendCustomPacket(PacketPlayOutTitle.subtitle(subtitle)); + p.sendCustomPacket(PacketPlayOutTitle.times(fadeIn,stay,fadeOut)); } } diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/ActionBar.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/ActionBar.java index cbb31bf..d9e4c6e 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/ActionBar.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/ActionBar.java @@ -12,14 +12,6 @@ public class ActionBar implements JoinEventListener { - private final TabFeature feature; - - public ActionBar(TabFeature feature) { - feature.setDisplayName("&aActionBar"); - this.feature = feature; - - } - @Override public void onJoin(TabPlayer p) { p.loadPropertyFromConfig("actionbar"); @@ -39,7 +31,7 @@ public List getLists() { } @Override - public TabFeature getFeatureType() { - return feature; + public Object getFeatureType() { + return TAFeature.ACTIONBAR; } } diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/NametagInRange.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/NametagInRange.java index 2999a56..30e7485 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/NametagInRange.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/NametagInRange.java @@ -3,21 +3,15 @@ import io.github.tanguygab.tabadditions.shared.TABAdditions; import me.neznamy.tab.api.TabPlayer; import me.neznamy.tab.shared.TAB; -import me.neznamy.tab.shared.cpu.TabFeature; import me.neznamy.tab.shared.cpu.UsageType; import me.neznamy.tab.shared.features.types.Loadable; import me.neznamy.tab.shared.features.types.event.JoinEventListener; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; public class NametagInRange implements Loadable, JoinEventListener { - private final TabFeature feature; - - public NametagInRange(TabFeature feature) { - feature.setDisplayName("&aNametag in Range"); - this.feature = feature; + public NametagInRange() { for (TabPlayer p : TAB.getInstance().getPlayers()) { for (TabPlayer p2 : TAB.getInstance().getPlayers()) { if (p != p2) @@ -37,7 +31,7 @@ public void onJoin(TabPlayer p) { @Override public void load() { - TAB.getInstance().getCPUManager().startRepeatingMeasuredTask(500,"handling Nametag In Range", feature, UsageType.REPEATING_TASK,()->{ + TAB.getInstance().getCPUManager().startRepeatingMeasuredTask(500,"handling Nametag In Range", TAFeature.NAMETAG_IN_RANGE, UsageType.REPEATING_TASK,()->{ int zone = (int) Math.pow(TABAdditions.getInstance().nametagInRange, 2); for (Player p : Bukkit.getServer().getOnlinePlayers()) { for (Player player : Bukkit.getServer().getOnlinePlayers()) { @@ -65,7 +59,7 @@ public void unload() { } @Override - public TabFeature getFeatureType() { - return feature; + public Object getFeatureType() { + return TAFeature.NAMETAG_IN_RANGE; } } diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/OnlyYou.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/OnlyYou.java index 48db578..2311f21 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/OnlyYou.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/OnlyYou.java @@ -11,12 +11,9 @@ public class OnlyYou implements JoinEventListener, Loadable { - private final TabFeature feature; private final Plugin plugin; - public OnlyYou(TabFeature feature) { - feature.setDisplayName("&aOnly You"); - this.feature = feature; + public OnlyYou() { plugin = (Plugin) TABAdditions.getInstance().getPlugin(); load(); } @@ -54,7 +51,7 @@ public void onJoin(TabPlayer tabPlayer) { } @Override - public TabFeature getFeatureType() { - return feature; + public Object getFeatureType() { + return TAFeature.ONLY_YOU; } } diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/SneakHideNametag.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/SneakHideNametag.java index 3634aae..31308d8 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/SneakHideNametag.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/SneakHideNametag.java @@ -10,15 +10,8 @@ public class SneakHideNametag implements SneakEventListener { - private final TabFeature feature; - private final Map tag = new HashMap<>(); - public SneakHideNametag(TabFeature feature) { - feature.setDisplayName("&aSneak Hide Nametag"); - this.feature = feature; - } - @Override public void onSneak(TabPlayer p, boolean isSneaking) { if (TABAdditions.getInstance().sneakhideEnabled) { @@ -31,7 +24,7 @@ public void onSneak(TabPlayer p, boolean isSneaking) { } @Override - public TabFeature getFeatureType() { - return feature; + public Object getFeatureType() { + return TAFeature.SNEAK_HIDE_NAMETAG; } } diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/TAFeature.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/TAFeature.java new file mode 100644 index 0000000..53e4ebd --- /dev/null +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/TAFeature.java @@ -0,0 +1,26 @@ +package io.github.tanguygab.tabadditions.shared.features; + +public enum TAFeature { + + ACTIONBAR("ActionBar&r"), + TITLE("Title"), + CHAT("Chat"), + TA_LAYOUT("TAB+ Layout"), + RFP("Real Fake Players"), + SNEAK_HIDE_NAMETAG("Sneak Hide Nametag"), + NAMETAG_IN_RANGE("Nametag in Range"), + TABLIST_NAMES_RADIUS("Tablist Names Radius"), + ONLY_YOU("Only You"), + UNLIMITED_ITEM_LINES("Unlimited Item Lines"); + + private final String displayName; + + TAFeature(String displayName){ + this.displayName = displayName; + } + + @Override + public String toString() { + return "&a"+displayName+"&r"; + } +} diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/TablistNamesRadius.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/TablistNamesRadius.java index fd89c46..60d2972 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/TablistNamesRadius.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/TablistNamesRadius.java @@ -11,14 +11,11 @@ public class TablistNamesRadius implements Loadable, JoinEventListener { - private final TabFeature feature; private final Plugin plugin; private int task = -1; private boolean enabled = true; - public TablistNamesRadius(TabFeature feature) { - feature.setDisplayName("Tablist Names Radius"); - this.feature = feature; + public TablistNamesRadius() { plugin = (Plugin) TABAdditions.getInstance().getPlugin(); for (Player p : Bukkit.getServer().getOnlinePlayers()) { for (Player p2 : Bukkit.getServer().getOnlinePlayers()) { @@ -73,7 +70,7 @@ public void onJoin(TabPlayer tabPlayer) { } @Override - public TabFeature getFeatureType() { - return feature; + public Object getFeatureType() { + return TAFeature.TABLIST_NAMES_RADIUS; } } diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/Title.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/Title.java index aba6661..180fed4 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/Title.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/Title.java @@ -13,13 +13,6 @@ public class Title implements JoinEventListener { - private final TabFeature feature; - - public Title(TabFeature feature) { - feature.setDisplayName("&aTitle"); - this.feature = feature; - } - @Override public void onJoin(TabPlayer p) { p.loadPropertyFromConfig("title"); @@ -40,7 +33,7 @@ public List getLists() { } @Override - public TabFeature getFeatureType() { - return feature; + public Object getFeatureType() { + return TAFeature.TITLE; } } diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/UnlimitedItemLines.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/UnlimitedItemLines.java index 90a2071..f69942a 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/UnlimitedItemLines.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/UnlimitedItemLines.java @@ -6,11 +6,9 @@ import me.neznamy.tab.api.TabPlayer; import me.neznamy.tab.shared.Property; import me.neznamy.tab.shared.TAB; -import me.neznamy.tab.shared.cpu.TabFeature; import me.neznamy.tab.shared.features.types.Loadable; import me.neznamy.tab.shared.features.types.event.JoinEventListener; import me.neznamy.tab.shared.features.types.event.WorldChangeListener; -import org.bukkit.Material; import java.lang.reflect.Field; import java.util.HashMap; @@ -18,11 +16,7 @@ public class UnlimitedItemLines implements Loadable,WorldChangeListener, JoinEventListener { - private final TabFeature feature; - - public UnlimitedItemLines(TabFeature feature) { - feature.setDisplayName("&aUnlimited Item Lines"); - this.feature = feature; + public UnlimitedItemLines() { load(); } @@ -80,7 +74,7 @@ public BukkitItemLine createItemLine(TabPlayer p, ArmorStand as) { } @Override - public TabFeature getFeatureType() { - return feature; + public Object getFeatureType() { + return TAFeature.UNLIMITED_ITEM_LINES; } } diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/chat/ChatFormat.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/chat/ChatFormat.java index a465a99..2ea2bdd 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/chat/ChatFormat.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/chat/ChatFormat.java @@ -2,7 +2,6 @@ import io.github.tanguygab.tabadditions.shared.TABAdditions; import me.neznamy.tab.api.TabPlayer; -import me.neznamy.tab.shared.TAB; import me.neznamy.tab.shared.packets.IChatBaseComponent; import me.neznamy.tab.shared.placeholders.conditions.Condition; import java.util.ArrayList; diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/chat/ChatManager.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/chat/ChatManager.java index c827eb7..bb71157 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/chat/ChatManager.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/chat/ChatManager.java @@ -4,11 +4,11 @@ import io.github.tanguygab.tabadditions.shared.ConfigType; import io.github.tanguygab.tabadditions.shared.PlatformType; import io.github.tanguygab.tabadditions.shared.TABAdditions; +import io.github.tanguygab.tabadditions.shared.features.TAFeature; import io.github.tanguygab.tabadditions.spigot.TABAdditionsSpigot; import me.neznamy.tab.api.TabPlayer; import me.neznamy.tab.shared.TAB; import me.neznamy.tab.shared.config.YamlConfigurationFile; -import me.neznamy.tab.shared.cpu.TabFeature; import me.neznamy.tab.shared.cpu.UsageType; import me.neznamy.tab.shared.features.types.Loadable; import me.neznamy.tab.shared.features.types.event.ChatEventListener; @@ -29,7 +29,6 @@ public class ChatManager implements ChatEventListener, Loadable, JoinEventListen private TABAdditions plinstance; private static ChatManager instance; - private final TabFeature feature; private final Map formats = new HashMap<>(); public boolean mentionEnabled = true; @@ -37,9 +36,7 @@ public class ChatManager implements ChatEventListener, Loadable, JoinEventListen public String mentionInput = "@%player%"; public String mentionOutput = "&b"; - public ChatManager(TabFeature feature) { - feature.setDisplayName("&aChat"); - this.feature = feature; + public ChatManager() { instance = this; load(); } @@ -73,7 +70,7 @@ public void load() { mentionInput = config.getString("mention.input","@%player%"); mentionOutput = config.getString("mention.output","&b@%player%"); - TAB.getInstance().getCPUManager().startRepeatingMeasuredTask(500,"refreshing Chat props",feature, UsageType.REPEATING_TASK,() -> { + TAB.getInstance().getCPUManager().startRepeatingMeasuredTask(500,"refreshing Chat props", TAFeature.CHAT, UsageType.REPEATING_TASK,() -> { for (TabPlayer p : TAB.getInstance().getPlayers()) { p.loadPropertyFromConfig("chatprefix"); p.loadPropertyFromConfig("customchatname",p.getName()); @@ -276,8 +273,8 @@ public void onJoin(TabPlayer p) { } @Override - public TabFeature getFeatureType() { - return feature; + public Object getFeatureType() { + return TAFeature.CHAT; } } diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/layouts/LayoutManager.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/layouts/LayoutManager.java index 002b120..38a949a 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/layouts/LayoutManager.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/layouts/LayoutManager.java @@ -2,6 +2,7 @@ import io.github.tanguygab.tabadditions.shared.ConfigType; import io.github.tanguygab.tabadditions.shared.TABAdditions; +import io.github.tanguygab.tabadditions.shared.features.TAFeature; import me.neznamy.tab.api.TabPlayer; import me.neznamy.tab.shared.TAB; import me.neznamy.tab.shared.cpu.TabFeature; @@ -17,7 +18,6 @@ public class LayoutManager implements Loadable, JoinEventListener, CommandListener, QuitEventListener { private static LayoutManager instance; - private final TabFeature feature; private String togglecmd; private final Map layouts = new HashMap<>(); private final Map players = new HashMap<>(); @@ -25,9 +25,7 @@ public class LayoutManager implements Loadable, JoinEventListener, CommandListen public final Map toRemove = new HashMap<>(); public final List toggledOff = new ArrayList<>(); - public LayoutManager(TabFeature feature) { - feature.setDisplayName("&aTAB+ Layout"); - this.feature = feature; + public LayoutManager() { instance = this; load(); } @@ -65,7 +63,7 @@ public String getLayout(TabPlayer p) { } private void refresh() { - TAB.getInstance().getCPUManager().startRepeatingMeasuredTask(100,"handling TAB+ Layout",feature, UsageType.REPEATING_TASK,()->{ + TAB.getInstance().getCPUManager().startRepeatingMeasuredTask(100,"handling TAB+ Layout",TAFeature.TA_LAYOUT, UsageType.REPEATING_TASK,()->{ for (TabPlayer p : TAB.getInstance().getPlayers()) { if (!TABAdditions.getInstance().checkBedrock(p) && players.containsKey(p) && !players.get(p).equals(getLayout(p))) { toRemove.put(p, players.get(p)); @@ -161,8 +159,8 @@ public boolean onCommand(TabPlayer p, String msg) { } @Override - public TabFeature getFeatureType() { - return feature; + public Object getFeatureType() { + return TAFeature.TA_LAYOUT; } @Override diff --git a/src/main/java/io/github/tanguygab/tabadditions/shared/features/rfps/RFPManager.java b/src/main/java/io/github/tanguygab/tabadditions/shared/features/rfps/RFPManager.java index af8e3a0..a079489 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/shared/features/rfps/RFPManager.java +++ b/src/main/java/io/github/tanguygab/tabadditions/shared/features/rfps/RFPManager.java @@ -2,6 +2,7 @@ import io.github.tanguygab.tabadditions.shared.ConfigType; import io.github.tanguygab.tabadditions.shared.TABAdditions; +import io.github.tanguygab.tabadditions.shared.features.TAFeature; import me.neznamy.tab.api.TabPlayer; import me.neznamy.tab.shared.PacketAPI; import me.neznamy.tab.shared.TAB; @@ -16,12 +17,9 @@ public class RFPManager implements JoinEventListener, Loadable { - private final TabFeature feature; private final Map rfps = new HashMap<>(); - public RFPManager(TabFeature feature) { - feature.setDisplayName("&aReal Fake Players"); - this.feature = feature; + public RFPManager() { load(); } @@ -160,8 +158,8 @@ public void onJoin(TabPlayer p) { } @Override - public TabFeature getFeatureType() { - return feature; + public Object getFeatureType() { + return TAFeature.RFP; } diff --git a/src/main/java/io/github/tanguygab/tabadditions/spigot/BukkitItemLine.java b/src/main/java/io/github/tanguygab/tabadditions/spigot/BukkitItemLine.java index 7a8de7b..ab7fe56 100644 --- a/src/main/java/io/github/tanguygab/tabadditions/spigot/BukkitItemLine.java +++ b/src/main/java/io/github/tanguygab/tabadditions/spigot/BukkitItemLine.java @@ -76,7 +76,7 @@ public void setOffset(double offset) { @Override public void spawn(TabPlayer viewer) { for (Object packet : getSpawnPackets(viewer)) { - viewer.sendPacket(packet, TabFeature.ADDON_FEATURE_10); + viewer.sendPacket(packet); } } @@ -86,7 +86,7 @@ public void destroy(TabPlayer viewer) { try { Method method = BukkitArmorStand.class.getDeclaredMethod("getDestroyPacket"); method.setAccessible(true); - viewer.sendPacket(method.invoke(this), TabFeature.ADDON_FEATURE_10); + viewer.sendPacket(method.invoke(this)); } catch (Exception e) { e.printStackTrace(); } @@ -97,7 +97,7 @@ public void teleport(TabPlayer viewer) { try { Method method = BukkitArmorStand.class.getDeclaredMethod("getTeleportPacket", TabPlayer.class); method.setAccessible(true); - viewer.sendPacket(method.invoke(this,viewer), TabFeature.ADDON_FEATURE_10); + viewer.sendPacket(method.invoke(this,viewer)); } catch (Exception e) { e.printStackTrace(); }