diff --git a/pom.xml b/pom.xml
index 0d9e523..c6fc464 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
xyz.refinedev.api
TablistAPI
- 2.1
+ 2.2
8
diff --git a/src/main/java/xyz/refinedev/api/tablist/TablistHandler.java b/src/main/java/xyz/refinedev/api/tablist/TablistHandler.java
index e7457b5..2bde2a0 100644
--- a/src/main/java/xyz/refinedev/api/tablist/TablistHandler.java
+++ b/src/main/java/xyz/refinedev/api/tablist/TablistHandler.java
@@ -126,7 +126,7 @@ public void unload() {
}
// Destroy main tablist team
- Team team = player.getScoreboard().getTeam("tab");
+ Team team = player.getScoreboard().getTeam("ztab");
if (team != null) {
team.unregister();
}
diff --git a/src/main/java/xyz/refinedev/api/tablist/listener/TabListener.java b/src/main/java/xyz/refinedev/api/tablist/listener/TabListener.java
index 7d9f3cf..5ed7da7 100644
--- a/src/main/java/xyz/refinedev/api/tablist/listener/TabListener.java
+++ b/src/main/java/xyz/refinedev/api/tablist/listener/TabListener.java
@@ -19,7 +19,7 @@ public class TabListener implements Listener {
private final TablistHandler instance;
- @EventHandler(priority = EventPriority.LOW)
+ @EventHandler(priority = EventPriority.MONITOR)
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
@@ -37,7 +37,7 @@ public void onJoin(PlayerJoinEvent event) {
public void onQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
- Team team = player.getScoreboard().getTeam("tab");
+ Team team = player.getScoreboard().getTeam("ztab");
if (team != null) {
team.removeEntry(player.getName());
team.unregister();
diff --git a/src/main/java/xyz/refinedev/api/tablist/listener/TeamsPacketListener.java b/src/main/java/xyz/refinedev/api/tablist/listener/TeamsPacketListener.java
index 5b1334a..ba0e401 100644
--- a/src/main/java/xyz/refinedev/api/tablist/listener/TeamsPacketListener.java
+++ b/src/main/java/xyz/refinedev/api/tablist/listener/TeamsPacketListener.java
@@ -66,14 +66,14 @@ public void onPacketSend(PacketSendEvent event) {
WrapperPlayServerTeams teams = new WrapperPlayServerTeams(event);
if (teams.getTeamMode() != WrapperPlayServerTeams.TeamMode.REMOVE_ENTITIES) return;
- if (!teams.getTeamName().equals("tab")) {
+ if (!teams.getTeamName().equals("ztab")) {
teams.setTeamMode(WrapperPlayServerTeams.TeamMode.ADD_ENTITIES);
teams.setTeamName("tab");
Optional teamInfo = teams.getTeamInfo();
if (teamInfo.isPresent()) {
WrapperPlayServerTeams.ScoreBoardTeamInfo info = teamInfo.get();
- info.setDisplayName(Component.text("tab"));
+ info.setDisplayName(Component.text("ztab"));
}
}
} else */if (isClientNew && event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_UPDATE) {
@@ -118,10 +118,10 @@ private void preventGlitch(Player player, UserProfile userProfile) {
}
Scoreboard scoreboard = player.getScoreboard();
- Team team = scoreboard.getTeam("tab");
+ Team team = scoreboard.getTeam("ztab");
if (team == null) {
- team = scoreboard.registerNewTeam("tab");
+ team = scoreboard.registerNewTeam("ztab");
}
if (!team.hasEntry(online.getName())) {
diff --git a/src/main/java/xyz/refinedev/api/tablist/setup/TabLayout.java b/src/main/java/xyz/refinedev/api/tablist/setup/TabLayout.java
index 734d2e8..f2e1dbf 100644
--- a/src/main/java/xyz/refinedev/api/tablist/setup/TabLayout.java
+++ b/src/main/java/xyz/refinedev/api/tablist/setup/TabLayout.java
@@ -143,6 +143,20 @@ public void create() {
this.sendPacket(packetInfo);
}
+ // Add everyone to the "Tab" team
+ // These aren't really used for 1.17+ except for hiding our own name
+ Team bukkitTeam = scoreboard.getTeam("ztab");
+ if (bukkitTeam == null) {
+ bukkitTeam = scoreboard.registerNewTeam("ztab");
+ }
+
+ for (Player target : Bukkit.getOnlinePlayers()) {
+ if (target == null) continue;
+ if (bukkitTeam.hasEntry(target.getName())) continue;
+
+ bukkitTeam.addEntry(target.getName());
+ }
+
// Add them to their own team so that our own name doesn't show up
for ( int index = 0; index < 80; index++ ) {
int x = index % mod;
@@ -160,6 +174,15 @@ public void create() {
scoreboardTeam.addEntry(displayName);
}
}
+
+
+ for ( Player target : Bukkit.getOnlinePlayers() ) {
+ Team team = target.getScoreboard().getTeam("ztab");
+ if (team == null) continue;
+ if (team.hasEntry(player.getName())) continue;
+
+ team.addEntry(player.getName());
+ }
}
public void refresh() {