From 56a9bd077ca2ea30dac40a5331dd4ad8b4a86437 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 6 Dec 2023 16:35:30 +0100 Subject: [PATCH 1/3] Add external players of teamserver to tablist of player --- src/de/steamwar/bungeecore/tablist/Tablist.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/tablist/Tablist.java b/src/de/steamwar/bungeecore/tablist/Tablist.java index e5cf7f32..07cb5b3d 100644 --- a/src/de/steamwar/bungeecore/tablist/Tablist.java +++ b/src/de/steamwar/bungeecore/tablist/Tablist.java @@ -95,8 +95,9 @@ public class Tablist extends MessageToMessageDecoder { update.add(tabItem); } } + boolean playerOnTeamserver = !Storage.teamServers.containsValue(player.getServer().getInfo()); for(PlayerListItem.Item item : directTabItems.values()) { - if(!nonNPCs.contains(item.getUuid()) && !npcs.contains(item.getUuid()) && !player.getUniqueId().equals(item.getUuid())) { + if(!playerOnTeamserver && !nonNPCs.contains(item.getUuid()) && !npcs.contains(item.getUuid()) && !player.getUniqueId().equals(item.getUuid())) { npcs.add(item.getUuid()); addNpc.add(item.getUsername()); } @@ -210,10 +211,13 @@ public class Tablist extends MessageToMessageDecoder { } break; case ADD_PLAYER: + boolean playerOnTeamserver = !Storage.teamServers.containsValue(player.getServer().getInfo()); for (PlayerListItem.Item item : list.getItems()) { item.setPing(1); - item.setDisplayName(new TextComponent()); - item.setListed(false); + if (playerOnTeamserver) { + item.setDisplayName(new TextComponent()); + item.setListed(false); + } item.setPublicKey(null); if(!player.getUniqueId().equals(item.getUuid()) && item.getGamemode() == 3) item.setGamemode(1); From bfefd5a197a8e9617abf5ee5fb2df96d1280ee4e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 6 Dec 2023 16:38:42 +0100 Subject: [PATCH 2/3] Remove some useless boolean inverts --- src/de/steamwar/bungeecore/tablist/Tablist.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/tablist/Tablist.java b/src/de/steamwar/bungeecore/tablist/Tablist.java index 07cb5b3d..1fde532d 100644 --- a/src/de/steamwar/bungeecore/tablist/Tablist.java +++ b/src/de/steamwar/bungeecore/tablist/Tablist.java @@ -95,9 +95,9 @@ public class Tablist extends MessageToMessageDecoder { update.add(tabItem); } } - boolean playerOnTeamserver = !Storage.teamServers.containsValue(player.getServer().getInfo()); + boolean playerOnTeamserver = Storage.teamServers.containsValue(player.getServer().getInfo()); for(PlayerListItem.Item item : directTabItems.values()) { - if(!playerOnTeamserver && !nonNPCs.contains(item.getUuid()) && !npcs.contains(item.getUuid()) && !player.getUniqueId().equals(item.getUuid())) { + if(playerOnTeamserver && !nonNPCs.contains(item.getUuid()) && !npcs.contains(item.getUuid()) && !player.getUniqueId().equals(item.getUuid())) { npcs.add(item.getUuid()); addNpc.add(item.getUsername()); } @@ -211,10 +211,10 @@ public class Tablist extends MessageToMessageDecoder { } break; case ADD_PLAYER: - boolean playerOnTeamserver = !Storage.teamServers.containsValue(player.getServer().getInfo()); + boolean playerNotOnTeamserver = !Storage.teamServers.containsValue(player.getServer().getInfo()); for (PlayerListItem.Item item : list.getItems()) { item.setPing(1); - if (playerOnTeamserver) { + if (playerNotOnTeamserver) { item.setDisplayName(new TextComponent()); item.setListed(false); } From bdbe6157907c2bc6735f48d9cf7ff28897454ab7 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 6 Dec 2023 16:39:41 +0100 Subject: [PATCH 3/3] Yoyo am losten --- src/de/steamwar/bungeecore/tablist/Tablist.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/tablist/Tablist.java b/src/de/steamwar/bungeecore/tablist/Tablist.java index 1fde532d..d6f94db2 100644 --- a/src/de/steamwar/bungeecore/tablist/Tablist.java +++ b/src/de/steamwar/bungeecore/tablist/Tablist.java @@ -95,9 +95,9 @@ public class Tablist extends MessageToMessageDecoder { update.add(tabItem); } } - boolean playerOnTeamserver = Storage.teamServers.containsValue(player.getServer().getInfo()); + boolean playerNotOnTeamserver = !Storage.teamServers.containsValue(player.getServer().getInfo()); for(PlayerListItem.Item item : directTabItems.values()) { - if(playerOnTeamserver && !nonNPCs.contains(item.getUuid()) && !npcs.contains(item.getUuid()) && !player.getUniqueId().equals(item.getUuid())) { + if(playerNotOnTeamserver && !nonNPCs.contains(item.getUuid()) && !npcs.contains(item.getUuid()) && !player.getUniqueId().equals(item.getUuid())) { npcs.add(item.getUuid()); addNpc.add(item.getUsername()); }