diff --git a/pom.xml b/pom.xml index e1ec024..c7ea8c9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.skymc TabooLib - 4.06 + 4.07 UTF-8 diff --git a/src/main/java/com/ilummc/tlib/resources/TLocale.java b/src/main/java/com/ilummc/tlib/resources/TLocale.java index 9747a35..c696a4d 100644 --- a/src/main/java/com/ilummc/tlib/resources/TLocale.java +++ b/src/main/java/com/ilummc/tlib/resources/TLocale.java @@ -155,5 +155,6 @@ public class TLocale { sender.sendMessage(TextComponent.toLegacyText(ComponentSerializer.parse(rawMessage))); } } + } } diff --git a/src/main/java/me/skymc/taboolib/itagapi/TagDataHandler.java b/src/main/java/me/skymc/taboolib/itagapi/TagDataHandler.java index 8d58ea8..4770dbf 100644 --- a/src/main/java/me/skymc/taboolib/itagapi/TagDataHandler.java +++ b/src/main/java/me/skymc/taboolib/itagapi/TagDataHandler.java @@ -6,6 +6,7 @@ import me.skymc.taboolib.packet.PacketUtils; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerJoinEvent; @@ -156,7 +157,7 @@ public class TagDataHandler implements Listener { downloadPlayerVariable(e.getPlayer()); } - @EventHandler + @EventHandler (priority = EventPriority.MONITOR) public void onQuit(PlayerQuitEvent e) { cancelPlayerVariable(e.getPlayer(), unregisterPlayerData(e.getPlayer())); } diff --git a/src/main/java/me/skymc/taboolib/itagapi/TagPacket.java b/src/main/java/me/skymc/taboolib/itagapi/TagPacket.java index 595106c..d4d19f8 100644 --- a/src/main/java/me/skymc/taboolib/itagapi/TagPacket.java +++ b/src/main/java/me/skymc/taboolib/itagapi/TagPacket.java @@ -14,6 +14,7 @@ import me.skymc.taboolib.events.itag.PlayerReceiveNameTagEvent; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; diff --git a/src/main/java/me/skymc/taboolib/itagapi/TagPlayerData.java b/src/main/java/me/skymc/taboolib/itagapi/TagPlayerData.java index 9718614..b7ceb67 100644 --- a/src/main/java/me/skymc/taboolib/itagapi/TagPlayerData.java +++ b/src/main/java/me/skymc/taboolib/itagapi/TagPlayerData.java @@ -1,9 +1,11 @@ package me.skymc.taboolib.itagapi; import com.ilummc.tlib.util.Strings; +import me.skymc.taboolib.Main; import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import java.text.MessageFormat; import java.util.Objects; import java.util.UUID; @@ -14,19 +16,21 @@ import java.util.UUID; public class TagPlayerData { private final UUID uuid; + private final String nameOrigin; private String nameDisplay; private String prefix; private String suffix; public TagPlayerData(Player player) { this.uuid = player.getUniqueId(); + this.nameOrigin = player.getName(); this.nameDisplay = player.getName(); this.prefix = ""; this.suffix = ""; } public String getTeamHash() { - return String.valueOf(Objects.hash(prefix)); + return Main.getInst().getConfig().getBoolean("TABLIST-SORT") ? String.valueOf(Objects.hash(prefix)) : nameOrigin; } public TagPlayerData reset() { @@ -38,7 +42,7 @@ public class TagPlayerData { @Override public String toString() { - return Strings.replaceWithOrder("TagPlayerData'{'uuid={0}, nameDisplay=''{1}'', prefix=''{2}'', suffix=''{3}'''}'", uuid, nameDisplay, prefix, suffix); + return Strings.replaceWithOrder("TagPlayerData'{'uuid={0}, nameOrigin=''{1}'', nameDisplay=''{2}'', prefix=''{3}'', suffix=''{4}'''}'", uuid, nameOrigin, nameDisplay, prefix, suffix); } // ********************************* @@ -52,7 +56,7 @@ public class TagPlayerData { } public String getNameOrigin() { - return Bukkit.getPlayer(uuid).getName(); + return nameOrigin; } public String getNameDisplay() { diff --git a/src/main/java/me/skymc/taboolib/nms/NMSUtil19.java b/src/main/java/me/skymc/taboolib/nms/NMSUtil19.java index 7177ddd..94ecc74 100644 --- a/src/main/java/me/skymc/taboolib/nms/NMSUtil19.java +++ b/src/main/java/me/skymc/taboolib/nms/NMSUtil19.java @@ -921,13 +921,16 @@ public class NMSUtil19 { return result; } - public static Class fixBukkitClass(String className) throws ClassNotFoundException { + public static Class fixBukkitClass(String className) { if (!versionPrefix.isEmpty()) { className = className.replace("org.bukkit.craftbukkit.", "org.bukkit.craftbukkit." + versionPrefix); className = className.replace("net.minecraft.server.", "net.minecraft.server." + versionPrefix); } - return NMSUtils.class.getClassLoader().loadClass(className); + try { + return NMSUtils.class.getClassLoader().loadClass(className); + } catch (ClassNotFoundException ignored) { + } } public static Object getHandle(Server server) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 91a40b6..9f49274 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -33,6 +33,10 @@ LOCALE: # 关闭可提升性能 # 如果需要开启仍然可以在语言文件中加入 papi: true USE_PAPI: false + +# 玩家列表(TAB)是否根据前缀排序 +# 启用后将会导致部分通过计分板获取玩家数据的插件出错(BedwarsRel、SkyWars) +TABLIST-SORT: false # 是否启用更新检测 UPDATE-CHECK: true