forked from Upstream/Velocitab
Fixed vanish problem (#116)
This commit is contained in:
parent
7c61d82ce6
commit
83195d0e72
@ -199,8 +199,8 @@ public class PlayerTabList {
|
||||
.build());
|
||||
}
|
||||
|
||||
private void addEntry(@NotNull TabPlayer player, @NotNull TabList tabList, @NotNull Component displayName) {
|
||||
TabListEntry.builder()
|
||||
private TabListEntry createEntry(@NotNull TabPlayer player, @NotNull TabList tabList, @NotNull Component displayName) {
|
||||
return TabListEntry.builder()
|
||||
.profile(player.getPlayer().getGameProfile())
|
||||
.displayName(displayName)
|
||||
.latency(0)
|
||||
@ -437,17 +437,15 @@ public class PlayerTabList {
|
||||
public void unVanishPlayer(@NotNull TabPlayer tabPlayer) {
|
||||
final UUID uuid = tabPlayer.getPlayer().getUniqueId();
|
||||
|
||||
tabPlayer.getDisplayName(plugin).thenAccept(c -> {
|
||||
players.values().forEach(p -> {
|
||||
if (p.getPlayer().equals(tabPlayer.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
tabPlayer.getDisplayName(plugin).thenAccept(c -> players.values().forEach(p -> {
|
||||
if (p.getPlayer().equals(tabPlayer.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!p.getPlayer().getTabList().containsEntry(uuid)) {
|
||||
addEntry(tabPlayer, p.getPlayer().getTabList(), c);
|
||||
}
|
||||
});
|
||||
});
|
||||
if (!p.getPlayer().getTabList().containsEntry(uuid)) {
|
||||
p.getPlayer().getTabList().addEntry(createEntry(tabPlayer, p.getPlayer().getTabList(), c));
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ public class VanishManager {
|
||||
public void vanishPlayer(@NotNull Player player) {
|
||||
final Optional<TabPlayer> tabPlayer = plugin.getTabList().getTabPlayer(player);
|
||||
if (tabPlayer.isEmpty()) {
|
||||
plugin.log("Failed to vanish player " + player.getUsername() + " as they are not in the tab list");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -66,6 +67,7 @@ public class VanishManager {
|
||||
public void unVanishPlayer(@NotNull Player player) {
|
||||
final Optional<TabPlayer> tabPlayer = plugin.getTabList().getTabPlayer(player);
|
||||
if (tabPlayer.isEmpty()) {
|
||||
plugin.log("Failed to unVanish player " + player.getUsername() + " as they are not in the tab list");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user