Added VelocitabAPI#getServerGroup and fixed problem while un-vanishing

This commit is contained in:
AlexDev_ 2023-11-08 16:55:29 +01:00
parent 83195d0e72
commit 938ce9e077
2 changed files with 14 additions and 0 deletions

View File

@ -163,6 +163,18 @@ import java.util.Optional;
plugin.getVanishManager().unVanishPlayer(player);
}
/**
* Retrieves the server group that the given player is connected to.
*
* @param player the player for whom to retrieve the server group
* @return the name of the server group that the player is connected to,
* or an empty string if the player is not in a group server
*/
@NotNull
public String getServerGroup(@NotNull Player player) {
return getUser(player).map(t -> t.getServerGroup(plugin)).orElse("");
}
static final class NotRegisteredException extends IllegalStateException {

View File

@ -444,6 +444,8 @@ public class PlayerTabList {
if (!p.getPlayer().getTabList().containsEntry(uuid)) {
p.getPlayer().getTabList().addEntry(createEntry(tabPlayer, p.getPlayer().getTabList(), c));
} else {
p.getPlayer().getTabList().getEntry(uuid).ifPresent(entry -> entry.setDisplayName(c));
}
}));