geforkt von SteamWar/BungeeCore
Fix TablistManager
Dieser Commit ist enthalten in:
Ursprung
a132aafcbc
Commit
0cc93f433e
@ -197,9 +197,25 @@ public class TablistManager extends BasicListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int slimSize(ProxiedPlayer viewer) {
|
public int slimSize(ProxiedPlayer viewer) {
|
||||||
int size = subTablists.stream().mapToInt(tPart -> viewer == null ? tPart.size() : tPart.slimSize(viewer)).sum();
|
int size = 0;
|
||||||
if(withHeaders)
|
for (int i = 0; i < subTablists.size(); i++) {
|
||||||
size += subTablists.size() * 2;
|
TablistPart tablistPart = subTablists.get(i);
|
||||||
|
boolean removeFooter = i == subTablists.size() - 1;
|
||||||
|
if (viewer == null) {
|
||||||
|
size += tablistPart.size();
|
||||||
|
if (withHeaders) size += 2; // The 2 is for the header and footer
|
||||||
|
if (removeFooter) size--; // The last one has no footer
|
||||||
|
} else {
|
||||||
|
int slimSize = tablistPart.slimSize(viewer);
|
||||||
|
if (slimSize == 0) {
|
||||||
|
if (withHeaders) size++; // This increment is just for the header
|
||||||
|
} else {
|
||||||
|
size += slimSize;
|
||||||
|
if (withHeaders) size += 2; // The 2 is for the header and footer
|
||||||
|
if (removeFooter) size--; // The last one has no footer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,8 +226,10 @@ public class TablistManager extends BasicListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void print(Tablist viewer, boolean slim) {
|
public void print(Tablist viewer, boolean slim) {
|
||||||
subTablists.forEach(tPart -> {
|
for (int i = 0; i < subTablists.size(); i++) {
|
||||||
if(withHeaders)
|
TablistPart tPart = subTablists.get(i);
|
||||||
|
boolean removeFooter = i == subTablists.size() - 1;
|
||||||
|
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();
|
||||||
@ -219,16 +237,19 @@ public class TablistManager extends BasicListener {
|
|||||||
viewer.setSlot(gray, "§7§l" + tPart.name(), 1000);
|
viewer.setSlot(gray, "§7§l" + tPart.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" + tPart.name() + " §8(§7" + size + "§8)", 1000);
|
||||||
|
removeFooter = true;
|
||||||
} else {
|
} else {
|
||||||
viewer.setSlot(gray, "§7§l" + tPart.name() + " §8(§7+" + (size - slimSize) + "§8)", 1000);
|
viewer.setSlot(gray, "§7§l" + tPart.name() + " §8(§7+" + (size - slimSize) + "§8)", 1000);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewer.setSlot(gray, "§7§l" + tPart.name(), 1000);
|
viewer.setSlot(gray, "§7§l" + tPart.name(), 1000);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
tPart.print(viewer, slim);
|
tPart.print(viewer, slim);
|
||||||
if(withHeaders)
|
if (withHeaders && !removeFooter) {
|
||||||
viewer.setSlot(darkGray, "", 1000);
|
viewer.setSlot(darkGray, "", 1000);
|
||||||
});
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren