From 1087cdb74cd2b7e7e49ff29cf90703bb1879975f Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 18 Dec 2021 14:20:35 +0100 Subject: [PATCH] Add better Tablist Slim behaviour --- .../bungeecore/listeners/TablistManager.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/TablistManager.java b/src/de/steamwar/bungeecore/listeners/TablistManager.java index 59f44bf..066facb 100644 --- a/src/de/steamwar/bungeecore/listeners/TablistManager.java +++ b/src/de/steamwar/bungeecore/listeners/TablistManager.java @@ -212,7 +212,19 @@ public class TablistManager extends BasicListener { public void print(Tablist viewer, boolean slim) { subTablists.forEach(tPart -> { if(withHeaders) - viewer.setSlot(gray, "§7§l" + tPart.name(), 1000); + if (slim) { + int slimSize = tPart.slimSize(viewer.player); + int size = tPart.size(); + if (size == slimSize) { + viewer.setSlot(gray, "§7§l" + tPart.name(), 1000); + } else if (slimSize == 0) { + viewer.setSlot(gray, "§7§l" + tPart.name() + " §8(§7" + size + "§8)", 1000); + } else { + viewer.setSlot(gray, "§7§l" + tPart.name() + " §8(§7+" + (size - slimSize) + "§8)", 1000); + } + } else { + viewer.setSlot(gray, "§7§l" + tPart.name(), 1000); + } tPart.print(viewer, slim); if(withHeaders) viewer.setSlot(darkGray, "", 1000); -- 2.39.5