版本更新至 4.07

修复:玩家列表排序导致其他小游戏插件报废(自己写个容器保存玩家能累死?非要用傻逼计分板?)
修复:1.8 首次发送 Json 报错问题
This commit is contained in:
坏黑 2018-05-31 22:16:50 +08:00
parent 5843e0be04
commit efeb088a70
7 changed files with 21 additions and 7 deletions

View File

@ -6,7 +6,7 @@
<groupId>me.skymc</groupId>
<artifactId>TabooLib</artifactId>
<version>4.06</version>
<version>4.07</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -155,5 +155,6 @@ public class TLocale {
sender.sendMessage(TextComponent.toLegacyText(ComponentSerializer.parse(rawMessage)));
}
}
}
}

View File

@ -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()));
}

View File

@ -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;

View File

@ -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() {

View File

@ -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);
}
try {
return NMSUtils.class.getClassLoader().loadClass(className);
} catch (ClassNotFoundException ignored) {
}
}
public static Object getHandle(Server server) {

View File

@ -34,6 +34,10 @@ LOCALE:
# 如果需要开启仍然可以在语言文件中加入 papi: true
USE_PAPI: false
# 玩家列表TAB是否根据前缀排序
# 启用后将会导致部分通过计分板获取玩家数据的插件出错BedwarsRel、SkyWars
TABLIST-SORT: false
# 是否启用更新检测
UPDATE-CHECK: true