Compare commits

..
10 Commits
42 changed files with 131 additions and 76 deletions

No files matched your search

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="138" height="20" role="img" aria-label="Minecraft: 1.5 - 1.21.8"><title>Minecraft: 1.5 - 1.21.8</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="138" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="77" height="20" fill="#007ec6"/><rect width="138" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">Minecraft</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">Minecraft</text><text aria-hidden="true" x="985" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="670">1.5 - 1.21.8</text><text x="985" y="140" transform="scale(.1)" fill="#fff" textLength="670">1.5 - 1.21.8</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="148" height="20" role="img" aria-label="Minecraft: 1.7.x - 1.21.9"><title>Minecraft: 1.7.x - 1.21.9</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="148" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="87" height="20" fill="#007ec6"/><rect width="148" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">Minecraft</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">Minecraft</text><text aria-hidden="true" x="1035" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="770">1.7.x - 1.21.9</text><text x="1035" y="140" transform="scale(.1)" fill="#fff" textLength="770">1.7.x - 1.21.9</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="92" height="20" role="img" aria-label="Release: 5.2.5"><title>Release: 5.2.5</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="92" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="53" height="20" fill="#555"/><rect x="53" width="39" height="20" fill="#007ec6"/><rect width="92" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">Release</text><text x="275" y="140" transform="scale(.1)" fill="#fff" textLength="430">Release</text><text aria-hidden="true" x="715" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="290">5.2.5</text><text x="715" y="140" transform="scale(.1)" fill="#fff" textLength="290">5.2.5</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="92" height="20" role="img" aria-label="Release: 5.3.0"><title>Release: 5.3.0</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="92" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="53" height="20" fill="#555"/><rect x="53" width="39" height="20" fill="#007ec6"/><rect width="92" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="275" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">Release</text><text x="275" y="140" transform="scale(.1)" fill="#fff" textLength="430">Release</text><text aria-hidden="true" x="715" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="290">5.3.0</text><text x="715" y="140" transform="scale(.1)" fill="#fff" textLength="290">5.3.0</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

+2 -2
View File
@@ -274,10 +274,10 @@ if __name__ == "__main__":
]
)
release = "5.2.5"
release = "5.3.0"
download_image(f"https://img.shields.io/badge/Release-{release}-blue.svg", "Badge_Release.svg")
minecraft = "1.5 - 1.21.8".replace(" ", "%20").replace("-", "--")
minecraft = "1.7.x - 1.21.9".replace(" ", "%20").replace("-", "--")
download_image(f"https://img.shields.io/badge/Minecraft-{minecraft}-blue.svg", "Badge_Minecraft.svg")
java = "8+"
+1 -1
View File
@@ -4,7 +4,7 @@ plugins {
allprojects {
group = "me.neznamy"
version = "5.3.0"
version = "5.3.1"
description = "An all-in-one solution that works"
ext.set("id", "tab")
@@ -128,7 +128,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -131,7 +131,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -133,7 +133,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -130,7 +130,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -130,7 +130,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -130,7 +130,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -130,7 +130,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -130,7 +130,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -130,7 +130,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -130,7 +130,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -129,7 +129,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == UPDATE_GAME_MODE || action == ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.getById(forcedGameMode));
}
if (action == UPDATE_LATENCY || action == ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -129,7 +129,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == UPDATE_GAME_MODE || action == ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.a(forcedGameMode));
}
if (action == UPDATE_LATENCY || action == ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -129,7 +129,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == UPDATE_GAME_MODE || action == ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.a(forcedGameMode));
}
if (action == UPDATE_LATENCY || action == ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -129,7 +129,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == UPDATE_GAME_MODE || action == ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.a(forcedGameMode));
}
if (action == UPDATE_LATENCY || action == ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -124,7 +124,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -4,9 +4,9 @@ import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import lombok.NonNull;
import lombok.SneakyThrows;
import me.neznamy.tab.shared.chat.component.TabComponent;
import me.neznamy.tab.platforms.bukkit.BukkitTabPlayer;
import me.neznamy.tab.shared.TAB;
import me.neznamy.tab.shared.chat.component.TabComponent;
import me.neznamy.tab.shared.platform.TabList;
import me.neznamy.tab.shared.platform.decorators.TrackedTabList;
import me.neznamy.tab.shared.util.ReflectionUtils;
@@ -126,7 +126,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, WorldSettings.EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -126,7 +126,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, WorldSettings.EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -4,9 +4,9 @@ import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import lombok.NonNull;
import lombok.SneakyThrows;
import me.neznamy.tab.shared.chat.component.TabComponent;
import me.neznamy.tab.platforms.bukkit.BukkitTabPlayer;
import me.neznamy.tab.shared.TAB;
import me.neznamy.tab.shared.chat.component.TabComponent;
import me.neznamy.tab.shared.platform.TabList;
import me.neznamy.tab.shared.platform.decorators.TrackedTabList;
import me.neznamy.tab.shared.util.ReflectionUtils;
@@ -127,7 +127,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, WorldSettings.EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -4,9 +4,9 @@ import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import lombok.NonNull;
import lombok.SneakyThrows;
import me.neznamy.tab.shared.chat.component.TabComponent;
import me.neznamy.tab.platforms.bukkit.BukkitTabPlayer;
import me.neznamy.tab.shared.TAB;
import me.neznamy.tab.shared.chat.component.TabComponent;
import me.neznamy.tab.shared.platform.TabList;
import me.neznamy.tab.shared.platform.decorators.TrackedTabList;
import me.neznamy.tab.shared.util.ReflectionUtils;
@@ -128,7 +128,7 @@ public class NMSPacketTabList extends TrackedTabList<BukkitTabPlayer> {
}
if (action == EnumPlayerInfoAction.UPDATE_GAME_MODE || action == EnumPlayerInfoAction.ADD_PLAYER) {
Integer forcedGameMode = getForcedGameModes().get(id);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, forcedGameMode);
if (forcedGameMode != null) PlayerInfoData_GameMode.set(nmsData, WorldSettings.EnumGamemode.getById(forcedGameMode));
}
if (action == EnumPlayerInfoAction.UPDATE_LATENCY || action == EnumPlayerInfoAction.ADD_PLAYER) {
if (getForcedLatency() != null) {
@@ -49,7 +49,7 @@ public class BungeeEventListener implements EventListener<ProxiedPlayer>, Listen
// Avoid 1.20.3+ client crash on scoreboard packets, do it sync to prevent packet being sent after event, but before processing
// Avoid 1.20.5+ client disconnect with "Network Protocol Error"
TabPlayer p = tab.getPlayer(e.getPlayer().getUniqueId());
if (p != null && p.getVersion().getNetworkId() >= ProtocolVersion.V1_20_2.getNetworkId()) {
if (p != null && p.getVersionId() >= ProtocolVersion.V1_20_2.getNetworkId()) {
((SafeScoreboard<?>)p.getScoreboard()).setFrozen(true);
((SafeBossBar<?>)p.getBossBar()).freeze();
}
@@ -61,14 +61,14 @@ public class BungeeEventListener implements EventListener<ProxiedPlayer>, Listen
// Things will get cleared immediately after, so no point in sending it, also someone said it fixed some warn from Geyser
// Sending these packets before login packet will also crash the client on 1.20.3
if (player.getVersion().getNetworkId() >= ProtocolVersion.V1_20_2.getNetworkId()) {
if (player.getVersionId() >= ProtocolVersion.V1_20_2.getNetworkId()) {
((SafeScoreboard<?>)player.getScoreboard()).setFrozen(true);
((SafeBossBar<?>)player.getBossBar()).freeze();
}
tab.getFeatureManager().onJoin(player);
} else {
tab.getFeatureManager().onServerChange(player.getUniqueId(), Server.byName(e.getPlayer().getServer().getInfo().getName()));
if (player.getVersion().getNetworkId() < ProtocolVersion.V1_20_2.getNetworkId()) {
if (player.getVersionId() < ProtocolVersion.V1_20_2.getNetworkId()) {
// For versions below 1.20.2 the tablist is already clean when this event is called
// For 1.20.2+ this event is called before, so we listen to Login packet instead
tab.getFeatureManager().onTabListClear(player);
@@ -286,9 +286,9 @@ public class BungeePlatform extends ProxyPlatform {
@Override
@NotNull
public TabList createTabList(@NotNull TabPlayer player) {
if (player.getVersion().getNetworkId() >= ProtocolVersion.V1_19_3.getNetworkId()) {
if (player.getVersionId() >= ProtocolVersion.V1_19_3.getNetworkId()) {
return new BungeeTabList1193((BungeeTabPlayer) player);
} else if (player.getVersion().getNetworkId() >= ProtocolVersion.V1_8.getNetworkId()) {
} else if (player.getVersionId() >= ProtocolVersion.V1_8.getNetworkId()) {
return new BungeeTabList18((BungeeTabPlayer) player);
} else {
return new BungeeTabList17((BungeeTabPlayer) player);
@@ -85,7 +85,7 @@ public class BungeeScoreboard extends SafeScoreboard<BungeeTabPlayer> {
@Override
public void removeScore(@NonNull Score score) {
if (player.getVersion().getNetworkId() >= ProtocolVersion.V1_20_3.getNetworkId()) {
if (player.getVersionId() >= ProtocolVersion.V1_20_3.getNetworkId()) {
player.sendPacket(new ScoreboardScoreReset(score.getHolder(), score.getObjective().getName()));
} else {
player.sendPacket(new ScoreboardScore(score.getHolder(), (byte) ScoreAction.REMOVE, score.getObjective().getName(), 0, null, null));
@@ -130,7 +130,7 @@ public class BungeeScoreboard extends SafeScoreboard<BungeeTabPlayer> {
@NotNull
private Either<String, NameTagVisibility> convertVisibility(@NotNull NameVisibility visibility) {
if (player.getVersion().getNetworkId() >= ProtocolVersion.V1_21_5.getNetworkId()) {
if (player.getVersionId() >= ProtocolVersion.V1_21_5.getNetworkId()) {
return Either.right(NameTagVisibility.valueOf(visibility.name()));
} else {
return Either.left(visibility.toString());
@@ -139,7 +139,7 @@ public class BungeeScoreboard extends SafeScoreboard<BungeeTabPlayer> {
@NotNull
private Either<String, net.md_5.bungee.protocol.packet.Team.CollisionRule> convertCollision(@NotNull CollisionRule collision) {
if (player.getVersion().getNetworkId() >= ProtocolVersion.V1_21_5.getNetworkId()) {
if (player.getVersionId() >= ProtocolVersion.V1_21_5.getNetworkId()) {
return Either.right(net.md_5.bungee.protocol.packet.Team.CollisionRule.valueOf(collision.name()));
} else {
return Either.left(collision.toString());
@@ -37,7 +37,7 @@ public class BungeeChannelDuplexHandler extends TabChannelDuplexHandler {
cpu.getProcessingThread().executeLater(new TimedCaughtTask(cpu, () -> {
((SafeScoreboard<?>)player.getScoreboard()).setFrozen(false);
player.getScoreboard().resend();
if (player.getVersion().getNetworkId() >= ProtocolVersion.V1_20_2.getNetworkId()) {
if (player.getVersionId() >= ProtocolVersion.V1_20_2.getNetworkId()) {
// For 1.20.2+ we need to do this, because server switch event is called before tablist is cleared
TAB.getInstance().getFeatureManager().onTabListClear(player);
((SafeBossBar<?>)player.getBossBar()).unfreezeAndResend();
@@ -103,7 +103,7 @@ public class BungeeTabList1193 extends BungeeTabList {
@Override
public void updateListOrder(@NonNull UUID entry, int listOrder) {
if (player.getVersion().getNetworkId() < ProtocolVersion.V1_21_2.getNetworkId()) return;
if (player.getVersionId() < ProtocolVersion.V1_21_2.getNetworkId()) return;
Item item = item(entry);
item.setListOrder(listOrder);
sendPacket(updateListOrder, item);
@@ -111,7 +111,7 @@ public class BungeeTabList1193 extends BungeeTabList {
@Override
public void updateHat(@NonNull UUID entry, boolean showHat) {
if (player.getVersion().getNetworkId() < ProtocolVersion.V1_21_4.getNetworkId()) return;
if (player.getVersionId() < ProtocolVersion.V1_21_4.getNetworkId()) return;
Item item = item(entry);
item.setShowHat(showHat);
sendPacket(updateHat, item);
@@ -121,9 +121,9 @@ public class BungeeTabList1193 extends BungeeTabList {
public void addEntry0(@NonNull Entry entry) {
addUuid(entry.getUniqueId());
EnumSet<PlayerListItemUpdate.Action> actions;
if (player.getVersion().getNetworkId() >= ProtocolVersion.V1_21_4.getNetworkId()) {
if (player.getVersionId() >= ProtocolVersion.V1_21_4.getNetworkId()) {
actions = addPlayer_1_21_4;
} else if (player.getVersion().getNetworkId() >= ProtocolVersion.V1_21_2.getNetworkId()) {
} else if (player.getVersionId() >= ProtocolVersion.V1_21_2.getNetworkId()) {
actions = addPlayer_1_21_2;
} else {
actions = addPlayer_legacy;
@@ -72,7 +72,9 @@ public class DebugCommand extends SubCommand {
return;
}
sendMessage(sender, "&ePlayer: &a" + analyzed.getName());
sendMessage(sender, "&ePlayer version: &a" + analyzed.getVersion().getFriendlyName());
sendMessage(sender, "&eInternal UUID: &a" + analyzed.getUniqueId());
sendMessage(sender, "&eTablist UUID: &a" + analyzed.getTablistId());
sendMessage(sender, "&ePlayer version: &a" + analyzed.getVersion().getFriendlyName() + " (" + analyzed.getVersionId() + ")");
if (analyzed instanceof ProxyTabPlayer) {
char versionRequired = TabConstants.PLUGIN_MESSAGE_CHANNEL_NAME.charAt(TabConstants.PLUGIN_MESSAGE_CHANNEL_NAME.length()-1);
sendMessage(sender, "&eBridge connection: " + (((ProxyTabPlayer)analyzed).isBridgeConnected() ?
@@ -92,13 +92,21 @@ public class FixedSlot extends RefreshableFeature {
*/
@NotNull
public static FixedSlot fromDefinition(@NotNull FixedSlotDefinition def, @NotNull LayoutPattern pattern, @NotNull LayoutManagerImpl manager) {
String skin;
if (def.getSkin() != null && !def.getSkin().isEmpty()) {
skin = def.getSkin();
} else if (pattern.getDefaultSkinDefinition() != null) {
skin = pattern.getDefaultSkinDefinition();
} else {
skin = manager.getConfiguration().getDefaultSkin(def.getSlot());
}
FixedSlot f = new FixedSlot(
manager,
def.getSlot(),
pattern,
manager.getUUID(def.getSlot()),
def.getText(),
def.getSkin() == null || def.getSkin().isEmpty() ? manager.getConfiguration().getDefaultSkin(def.getSlot()) : def.getSkin(),
skin,
def.getPing() == null ? manager.getConfiguration().getEmptySlotPing() : def.getPing()
);
if (!def.getText().isEmpty()) TAB.getInstance().getFeatureManager().registerFeature(TabConstants.Feature.layoutSlot(pattern.getName(), def.getSlot()), f);
@@ -108,8 +108,8 @@ public class LayoutConfiguration {
}
public String getEntryName(@NotNull TabPlayer viewer, int slot, boolean teamsEnabled) {
boolean legacySorting = viewer.getVersion().getNetworkId() < ProtocolVersion.V1_19_3.getNetworkId();
boolean modernSorting = viewer.getVersion().getNetworkId() >= ProtocolVersion.V1_21_2.getNetworkId() && TAB.getInstance().getPlatform().supportsListOrder();
boolean legacySorting = viewer.getVersionId() < ProtocolVersion.V1_19_3.getNetworkId();
boolean modernSorting = viewer.getVersionId() >= ProtocolVersion.V1_21_2.getNetworkId() && TAB.getInstance().getPlatform().supportsListOrder();
if (legacySorting || modernSorting) {
return "";
} else {
@@ -130,6 +130,7 @@ public class LayoutConfiguration {
public static class LayoutDefinition {
@Nullable private final String condition;
@Nullable private final String defaultSkin;
@NotNull private final List<FixedSlotDefinition> fixedSlots;
@NotNull private final LinkedHashMap<String, GroupPattern> groups;
@@ -145,7 +146,7 @@ public class LayoutConfiguration {
*/
public static LayoutDefinition fromSection(@NotNull String name, @NotNull ConfigurationSection section) {
// Check keys
section.checkForUnknownKey(Arrays.asList("condition", "fixed-slots", "groups"));
section.checkForUnknownKey(Arrays.asList("condition", "default-skin", "fixed-slots", "groups"));
List<FixedSlotDefinition> fixedSlots = new ArrayList<>();
for (String line : section.getStringList("fixed-slots", Collections.emptyList())) {
@@ -181,7 +182,12 @@ public class LayoutConfiguration {
groups.put(asString, pattern);
}
return new LayoutDefinition(section.getString("condition"), fixedSlots, groups);
return new LayoutDefinition(
section.getString("condition"),
section.getString("default-skin"),
fixedSlots,
groups
);
}
/**
@@ -167,7 +167,7 @@ public class LayoutManagerImpl extends RefreshableFeature implements LayoutManag
@NotNull
public Layout createNewLayout(@NonNull String name) {
ensureActive();
return new LayoutPattern(this, name, new LayoutDefinition(null, Collections.emptyList(), new LinkedHashMap<>()));
return new LayoutPattern(this, name, new LayoutDefinition(null, null, Collections.emptyList(), new LinkedHashMap<>()));
}
@Override
@@ -10,6 +10,7 @@ import me.neznamy.tab.shared.features.layout.LayoutConfiguration.LayoutDefinitio
import me.neznamy.tab.shared.features.layout.LayoutConfiguration.LayoutDefinition.GroupPattern;
import me.neznamy.tab.shared.features.types.RefreshableFeature;
import me.neznamy.tab.shared.placeholders.conditions.Condition;
import me.neznamy.tab.shared.platform.TabList;
import me.neznamy.tab.shared.platform.TabPlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -22,6 +23,8 @@ public class LayoutPattern extends RefreshableFeature implements Layout {
@NotNull private final LayoutManagerImpl manager;
@NotNull private final String name;
@Nullable private final Condition condition;
@Nullable private final String defaultSkinDefinition;
@Nullable private final TabList.Skin defaultSkin;
private final Map<Integer, FixedSlot> fixedSlots = new HashMap<>();
private final List<GroupPattern> groups = new ArrayList<>();
@@ -30,6 +33,8 @@ public class LayoutPattern extends RefreshableFeature implements Layout {
this.name = name;
condition = TAB.getInstance().getPlaceholderManager().getConditionManager().getByNameOrExpression(def.getCondition());
if (condition != null) manager.addUsedPlaceholder(TabConstants.Placeholder.condition(condition.getName()));
defaultSkinDefinition = def.getDefaultSkin();
defaultSkin = def.getDefaultSkin() == null ? null : manager.getSkinManager().getSkin(def.getDefaultSkin());
for (FixedSlotDefinition fixed : def.getFixedSlots()) {
addFixedSlot(fixed);
}
@@ -52,6 +57,21 @@ public class LayoutPattern extends RefreshableFeature implements Layout {
return condition == null || condition.isMet(p);
}
/**
* Returns default skin for this layout pattern. If not defined, uses default skin of specified slot.
* If that is also not defined, uses global default skin.
* May return {@code null} if no default skin is defined anywhere, or they are all invalid.
*
* @param slot
* slot to get default skin for if not defined in this pattern
* @return default skin for this layout pattern
*/
@Nullable
public TabList.Skin getDefaultSkin(int slot) {
if (defaultSkin != null) return defaultSkin;
return manager.getSkinManager().getDefaultSkin(slot);
}
@NotNull
@Override
public String getRefreshDisplayName() {
@@ -70,7 +90,12 @@ public class LayoutPattern extends RefreshableFeature implements Layout {
@Override
public void addFixedSlot(int slot, @NonNull String text) {
ensureActive();
addFixedSlot(slot, text, manager.getConfiguration().getDefaultSkin(slot), manager.getConfiguration().getEmptySlotPing());
addFixedSlot(
slot,
text,
defaultSkinDefinition != null ? defaultSkinDefinition : manager.getConfiguration().getDefaultSkin(slot),
manager.getConfiguration().getEmptySlotPing()
);
}
@Override
@@ -82,7 +107,12 @@ public class LayoutPattern extends RefreshableFeature implements Layout {
@Override
public void addFixedSlot(int slot, @NonNull String text, int ping) {
ensureActive();
addFixedSlot(slot, text, manager.getConfiguration().getDefaultSkin(slot), ping);
addFixedSlot(
slot,
text,
defaultSkinDefinition != null ? defaultSkinDefinition : manager.getConfiguration().getDefaultSkin(slot),
ping
);
}
@Override
@@ -1,6 +1,5 @@
package me.neznamy.tab.shared.features.layout;
import lombok.Getter;
import me.neznamy.tab.shared.config.skin.SkinManager;
import me.neznamy.tab.shared.platform.TabList.Skin;
import org.jetbrains.annotations.NotNull;
@@ -16,13 +15,13 @@ import java.util.Map.Entry;
public class LayoutSkinManager {
/** Skin manager to load skins with */
private final SkinManager skinManager;
@NotNull private final SkinManager skinManager;
/** Configured default skin */
@Getter private final Skin defaultSkin;
@Nullable private final Skin defaultSkin;
/** Default skins per slot */
private final Map<Integer, Skin> defaultSkinHashMap = new HashMap<>();
@NotNull private final Map<Integer, Skin> defaultSkinHashMap = new HashMap<>();
/**
* Constructs new instance with given parameters and loads cache.
@@ -50,7 +49,7 @@ public class LayoutSkinManager {
* Slot id
* @return Default skin for specified slot
*/
@NotNull
@Nullable
public Skin getDefaultSkin(int slot) {
return defaultSkinHashMap.getOrDefault(slot, defaultSkin);
}
@@ -51,7 +51,7 @@ public class LayoutView {
viewer.getTabList().addEntry(new TabList.Entry(
manager.getUUID(slot),
manager.getConfiguration().getDirection().getEntryName(viewer, slot, LayoutManagerImpl.isTeamsEnabled()),
manager.getSkinManager().getDefaultSkin(slot),
pattern.getDefaultSkin(slot),
true,
manager.getConfiguration().getEmptySlotPing(),
0,
@@ -52,7 +52,7 @@ public class PlayerSlot {
data = new TabList.Entry(
uniqueId,
layout.getManager().getConfiguration().getDirection().getEntryName(viewer, slot, LayoutManagerImpl.isTeamsEnabled()),
layout.getManager().getSkinManager().getDefaultSkin(slot),
layout.getPattern().getDefaultSkin(slot),
true,
layout.getManager().getConfiguration().getEmptySlotPing(),
0,
@@ -34,8 +34,7 @@ public class VisibilityRefresher extends RefreshableFeature implements JoinListe
@Override
public void load() {
int refresh = TAB.getInstance().getPlatform().isProxy() ? -1 : 500;
TAB.getInstance().getPlaceholderManager().registerInternalPlayerPlaceholder(TabConstants.Placeholder.INVISIBLE, refresh, p -> {
TAB.getInstance().getPlaceholderManager().registerInternalPlayerPlaceholder(TabConstants.Placeholder.INVISIBLE, 500, p -> {
TabPlayer player = (TabPlayer) p;
boolean newInvisibility = player.hasInvisibilityPotion() || invisibleCondition.isMet((TabPlayer) p);
if (newInvisibility) {
@@ -55,8 +54,7 @@ public class VisibilityRefresher extends RefreshableFeature implements JoinListe
public void onJoin(@NotNull TabPlayer connectedPlayer) {
if (invisibleCondition.isMet(connectedPlayer)) {
connectedPlayer.teamData.hideNametag(NameTagInvisibilityReason.MEETING_CONFIGURED_CONDITION);
} else {
connectedPlayer.teamData.showNametag(NameTagInvisibilityReason.MEETING_CONFIGURED_CONDITION);
nameTags.updateVisibility(connectedPlayer);
}
}
@@ -165,7 +165,7 @@ public class ScoreboardImpl extends RefreshableFeature implements me.neznamy.tab
p.scoreboardData.activeScoreboard = this;
recalculateScores(p);
TAB.getInstance().getPlaceholderManager().getTabExpansion().setScoreboardName(p, name);
if (containsNumberFormat && p.getVersion().getNetworkId() < ProtocolVersion.V1_20_3.getNetworkId()) {
if (containsNumberFormat && p.getVersionId() < ProtocolVersion.V1_20_3.getNetworkId()) {
TAB.getInstance().getConfigHelper().runtime().error("Scoreboard \"" + name + "\" contains right-side text alignment (using ||), however, this feature " +
"was added in 1.20.3, but player \"" + p.getName() + "\" is using version " + p.getVersion().getFriendlyName() + ". Right-side text " +
"will not be visible for them.");
@@ -57,7 +57,7 @@ public class UniversalPlaceholderRegistry {
manager.registerInternalPlayerPlaceholder(TabConstants.Placeholder.WORLD, -1, p -> ((TabPlayer)p).world.getName());
manager.registerInternalPlayerPlaceholder(TabConstants.Placeholder.SERVER, -1, p -> ((TabPlayer)p).server.getName());
manager.registerInternalPlayerPlaceholder(TabConstants.Placeholder.PLAYER_VERSION, -1, p -> ((TabPlayer)p).getVersion().getFriendlyName());
manager.registerInternalPlayerPlaceholder(TabConstants.Placeholder.PLAYER_VERSION_ID, -1, p -> PerformanceUtil.toString(((TabPlayer)p).getVersion().getNetworkId()));
manager.registerInternalPlayerPlaceholder(TabConstants.Placeholder.PLAYER_VERSION_ID, -1, p -> PerformanceUtil.toString(((TabPlayer)p).getVersionId()));
// Server
manager.registerInternalServerPlaceholder("%%", -1, () -> "%");
@@ -72,16 +72,7 @@ public class Condition {
expressions = new ArrayList<>(definition.getConditions());
yes = definition.getYes();
no = definition.getNo();
for (ConditionalExpression expression : expressions) {
if (expression instanceof Permission || expression instanceof NotPermission) {
int permissionRefresh = TAB.getInstance().getConfiguration().getConfig().getPermissionRefreshInterval();
if (refresh > permissionRefresh || refresh == -1) refresh = permissionRefresh;
} else {
ComparatorExpression comparator = (ComparatorExpression) expression;
placeholdersInConditions.addAll(Arrays.asList(comparator.getLeftSidePlaceholders()));
placeholdersInConditions.addAll(Arrays.asList(comparator.getRightSidePlaceholders()));
}
}
analyzeContent();
}
/**
@@ -110,6 +101,20 @@ public class Condition {
}
return expression;
}).filter(Objects::nonNull).collect(Collectors.toList());
analyzeContent();
}
private void analyzeContent() {
for (ConditionalExpression expression : expressions) {
if (expression instanceof Permission || expression instanceof NotPermission) {
int permissionRefresh = TAB.getInstance().getConfiguration().getConfig().getPermissionRefreshInterval();
if (refresh > permissionRefresh || refresh == -1) refresh = permissionRefresh;
} else {
ComparatorExpression comparator = (ComparatorExpression) expression;
placeholdersInConditions.addAll(Arrays.asList(comparator.getLeftSidePlaceholders()));
placeholdersInConditions.addAll(Arrays.asList(comparator.getRightSidePlaceholders()));
}
}
}
/**
@@ -17,7 +17,6 @@ import me.neznamy.tab.shared.event.impl.PlayerLoadEventImpl;
import me.neznamy.tab.shared.features.NickCompatibility;
import me.neznamy.tab.shared.features.belowname.BelowNamePlayerData;
import me.neznamy.tab.shared.features.bossbar.BossBarPlayerData;
import me.neznamy.tab.shared.features.globalplayerlist.GlobalPlayerList;
import me.neznamy.tab.shared.features.header.HeaderFooterPlayerData;
import me.neznamy.tab.shared.features.layout.LayoutManagerImpl;
import me.neznamy.tab.shared.features.nametags.NameTagPlayerData;
@@ -82,7 +81,10 @@ public abstract class TabPlayer implements me.neznamy.tab.api.TabPlayer {
/** Player's game type, {@code true} for Bedrock, {@code false} for Java */
@Getter private final boolean bedrockPlayer;
/** Player's game version */
/** Player's protocol version (actual retrieved value) */
@Getter private final int versionId;
/** Player's game version (evaluated to known versions) */
@Getter protected final ProtocolVersion version;
/**
@@ -175,6 +177,7 @@ public abstract class TabPlayer implements me.neznamy.tab.api.TabPlayer {
this.server = Server.byName(server);
this.world = World.byName(world);
nickname = name;
versionId = protocolVersion;
version = ProtocolVersion.fromNetworkId(protocolVersion);
bedrockPlayer = FloodgateHook.getInstance().isFloodgatePlayer(uniqueId, name);
permissionGroup = TAB.getInstance().getGroupManager().detectPermissionGroup(this);
@@ -28,6 +28,9 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public class VelocityEventListener implements EventListener<Player> {
/** Whether plugin should be compensating for bossbar bug that may or may not be fixed soon (it was fixed in a fork) */
private static final boolean BOSSBAR_BUG_COMPENSATION = true;
/** Map for tracking online players */
private final Map<Player, UUID> players = new ConcurrentHashMap<>();
@@ -55,10 +58,11 @@ public class VelocityEventListener implements EventListener<Player> {
*/
@Subscribe
public void preConnect(@NotNull ServerPreConnectEvent e) {
if (!BOSSBAR_BUG_COMPENSATION) return;
if (TAB.getInstance().isPluginDisabled()) return;
if (e.getResult().isAllowed()) {
TabPlayer p = TAB.getInstance().getPlayer(e.getPlayer().getUniqueId());
if (p != null && p.getVersion().getNetworkId() >= ProtocolVersion.V1_20_2.getNetworkId()) {
if (p != null && p.getVersionId() >= ProtocolVersion.V1_20_2.getNetworkId()) {
((SafeBossBar<?>)p.getBossBar()).freeze();
}
}
@@ -87,7 +91,7 @@ public class VelocityEventListener implements EventListener<Player> {
Server.byName(e.getPlayer().getCurrentServer().map(s -> s.getServerInfo().getName()).orElse("null"))
);
tab.getFeatureManager().onTabListClear(player);
if (player.getVersion().getNetworkId() >= ProtocolVersion.V1_20_2.getNetworkId()) {
if (BOSSBAR_BUG_COMPENSATION && player.getVersionId() >= ProtocolVersion.V1_20_2.getNetworkId()) {
((SafeBossBar<?>)player.getBossBar()).unfreezeAndResend();
}
}