From 45795512422430f78188ff10b78efe02aaca49de Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 5 Jul 2020 13:31:52 +0200 Subject: [PATCH] Change to bigger & better Tablist Signed-off-by: Lixfel --- .../bungeecore/listeners/TablistManager.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/TablistManager.java b/src/de/steamwar/bungeecore/listeners/TablistManager.java index e7fc6cae..7765ded2 100644 --- a/src/de/steamwar/bungeecore/listeners/TablistManager.java +++ b/src/de/steamwar/bungeecore/listeners/TablistManager.java @@ -74,8 +74,8 @@ public class TablistManager extends BasicListener { size = (size+19)/20; - if(size > 4) - size = 4; + if(size > 5) + size = 5; } private synchronized void updateCustomTablist(){ @@ -163,9 +163,9 @@ public class TablistManager extends BasicListener { i++; for (ProxiedPlayer p : playerMap.get(server)){ if(currentServer == p.getServer().getInfo()) - setSlot(i%20, i/20, BungeeTabListPlusAPI.getIconFromPlayer(p), p.getDisplayName(), 1); + setSlot(i%20, i/20, BungeeTabListPlusAPI.getIconFromPlayer(p), getTablistName(p), 1); else - setSlot(i%20, i/20, BungeeTabListPlusAPI.getIconFromPlayer(p), "§7" + p.getDisplayName(), 500); + setSlot(i%20, i/20, BungeeTabListPlusAPI.getIconFromPlayer(p), "§7" + getTablistName(p), 500); i++; } } @@ -179,5 +179,22 @@ public class TablistManager extends BasicListener { //Ignore NPE, happens sometimes (only 1s long) when somebody is joining, server switching or disconnecting } } + + 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(); + } } }