Archiviert
1
0

Fix TablistManager

Fix ListCommand
Dieser Commit ist enthalten in:
yoyosource 2022-05-24 21:40:58 +02:00
Ursprung 29b2aee2f1
Commit d06a0a9c12
2 geänderte Dateien mit 11 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -64,10 +64,11 @@ public class ListCommand extends BasicCommand {
public void execute(CommandSender commandSender, String[] strings) { public void execute(CommandSender commandSender, String[] strings) {
TreeMap<String, List<ProxiedPlayer>> playerMap = getCustomTablist(); TreeMap<String, List<ProxiedPlayer>> playerMap = getCustomTablist();
for (String server : playerMap.navigableKeySet()) { for (String server : playerMap.navigableKeySet()) {
String serverName = server;
if (server.equals("Bau")) { if (server.equals("Bau")) {
server = Message.parse("TABLIST_BAU", commandSender); serverName = Message.parse("TABLIST_BAU", commandSender);
} }
Message.send("LIST_COMMAND", commandSender, server, playerMap.get(server).stream().map(CommandSender::getName).collect(Collectors.joining(", "))); Message.send("LIST_COMMAND", commandSender, serverName, playerMap.get(server).stream().map(CommandSender::getName).collect(Collectors.joining(", ")));
} }
} }
} }

Datei anzeigen

@ -213,21 +213,25 @@ public class TablistManager extends BasicListener {
public void print(Tablist viewer, boolean slim) { public void print(Tablist viewer, boolean slim) {
for (int i = 0; i < subTablists.size(); i++) { for (int i = 0; i < subTablists.size(); i++) {
TablistPart tPart = subTablists.get(i); TablistPart tPart = subTablists.get(i);
String name = tPart.name();
if (name.equals("Bau")) {
name = Message.parse("TABLIST_BAU", viewer.player);
}
boolean withoutFooter = i == subTablists.size() - 1; boolean withoutFooter = i == subTablists.size() - 1;
if (withHeaders) { if (withHeaders) {
if (slim) { if (slim) {
int slimSize = tPart.slimSize(viewer.player); int slimSize = tPart.slimSize(viewer.player);
int size = tPart.size(); int size = tPart.size();
if (size == slimSize) { if (size == slimSize) {
viewer.setSlot(gray, "§7§l" + tPart.name(), 1000); viewer.setSlot(gray, "§7§l" + name, 1000);
} else if (slimSize == 0) { } else if (slimSize == 0) {
viewer.setSlot(gray, "§7§l" + tPart.name() + " §8(§7" + size + "§8)", 1000); viewer.setSlot(gray, "§7§l" + name + " §8(§7" + size + "§8)", 1000);
withoutFooter = true; withoutFooter = true;
} else { } else {
viewer.setSlot(gray, "§7§l" + tPart.name() + " §8(§7+" + (size - slimSize) + "§8)", 1000); viewer.setSlot(gray, "§7§l" + name + " §8(§7+" + (size - slimSize) + "§8)", 1000);
} }
} else { } else {
viewer.setSlot(gray, "§7§l" + tPart.name(), 1000); viewer.setSlot(gray, "§7§l" + name, 1000);
} }
} }
tPart.print(viewer, slim); tPart.print(viewer, slim);