Add only_list_players_in_same_group option (true by default)

This commit is contained in:
William 2023-03-23 22:14:31 +00:00
parent 6007cdddb3
commit dbf5509a9a
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View File

@ -49,6 +49,11 @@ public class Settings {
@YamlComment("The formats to use for the fallback group.")
private String fallbackGroup = "default";
@Getter
@YamlKey("only_list_players_in_same_group")
@YamlComment("Only show other players on a server that is part of the same server group as the player.")
private boolean onlyListPlayersInSameGroup = true;
@YamlKey("enable_papi_hook")
private boolean enablePapiHook = true;

View File

@ -73,9 +73,12 @@ public class PlayerTabList {
final Map<String, String> playerRoles = new HashMap<>();
for (TabPlayer player : players) {
if (serversInGroup.isPresent() && !serversInGroup.get().contains(player.getServerName())) {
continue; // Skip players on other servers
// Skip players on other servers if the setting is enabled
if (plugin.getSettings().isOnlyListPlayersInSameGroup() && serversInGroup.isPresent()
&& !serversInGroup.get().contains(player.getServerName())) {
continue;
}
playerRoles.put(player.getPlayer().getUsername(), player.getTeamName(plugin));
tabList.getEntries().stream()
.filter(e -> e.getProfile().getId().equals(player.getPlayer().getUniqueId())).findFirst()