From 9e7097e38d5ca32d89181919025af3cd7f83d935 Mon Sep 17 00:00:00 2001 From: jojo Date: Sat, 5 Sep 2020 12:58:46 +0200 Subject: [PATCH] Add TablistReadability by Bold names on same Server --- .../bungeecore/listeners/TablistManager.java | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/TablistManager.java b/src/de/steamwar/bungeecore/listeners/TablistManager.java index ee683cc..85335f0 100644 --- a/src/de/steamwar/bungeecore/listeners/TablistManager.java +++ b/src/de/steamwar/bungeecore/listeners/TablistManager.java @@ -181,10 +181,8 @@ public class TablistManager extends BasicListener { setSlot(i%20, i/20, gray, "§7§l" + server, 1000); i++; for (ProxiedPlayer p : playerMap.get(server)){ - if(currentServer == p.getServer().getInfo()) - setSlot(i%20, i/20, BungeeTabListPlusAPI.getIconFromPlayer(p), getTablistName(p), 1); - else - setSlot(i%20, i/20, BungeeTabListPlusAPI.getIconFromPlayer(p), "§7" + getTablistName(p), 500); + boolean sameServer = currentServer == p.getServer().getInfo(); + setSlot(i % 20, i / 20, BungeeTabListPlusAPI.getIconFromPlayer(p), getTablistName(p, sameServer), (sameServer ? 1 : 500)); i++; } } @@ -199,21 +197,18 @@ public class TablistManager extends BasicListener { } } - private String getTablistName(ProxiedPlayer p){ - if(p.hasPermission("bungeecore.group.admin")) - return "§4" + p.getName(); - else if(p.hasPermission("bungeecore.group.developer")) - return "§3" + p.getName(); - else if(p.hasPermission("bungeecore.group.moderator")) - return "§b" + p.getName(); - else if(p.hasPermission("bungeecore.group.supporter")) - return "§1" + p.getName(); - else if(p.hasPermission("bungeecore.group.builder")) - return "§2" + p.getName(); - else if(p.hasPermission("bungeecore.group.youtuber")) - return "§5" + p.getName(); - else - return p.getName(); + private String getTablistName(ProxiedPlayer p, boolean sameServer) { + StringBuilder st = new StringBuilder(); + if (p.hasPermission("bungeecore.group.admin")) st.append("§4"); + else if (p.hasPermission("bungeecore.group.developer")) st.append("§3"); + else if (p.hasPermission("bungeecore.group.moderator")) st.append("§b"); + else if (p.hasPermission("bungeecore.group.supporter")) st.append("§1"); + else if (p.hasPermission("bungeecore.group.builder")) st.append("§2"); + else if (p.hasPermission("bungeecore.group.youtuber")) st.append("§5"); + else st.append("§7"); + + if (sameServer) st.append("§l"); + return st.append(p.getName()).toString(); } } }