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