SteamWar/BungeeCore
Archiviert
13
2

Fix TablistManager add Team visibility #220

Manuell gemergt
Lixfel hat 11 Commits von SlimTeamMemberTab nach master 2021-06-27 07:50:56 +02:00 zusammengeführt
Nur Änderungen aus Commit 71c206e59c werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -174,17 +174,10 @@ public class TablistManager extends BasicListener {
server = Message.parse("TABLIST_BAU", player);
setSlot(i%20, i/20, gray, "§7§l" + server, 1000);
i++;
for (ProxiedPlayer p : playerMap.get(server)){
boolean sameServer = currentServer == p.getServer().getInfo();
setSlot(i % 20, i / 20, BungeeTabListPlusAPI.getIconFromPlayer(p), getTablistName(p), (sameServer ? 1 : 500));
i++;
}
i = update(currentServer, playerMap.get(server), i);
}
while (i < size*20){
setSlot(i%20, i/20, darkGray, "", 1000);
i++;
}
finish(i);
}catch(IndexOutOfBoundsException | NullPointerException e){
//Ignore IndexOutOfBoundsException
//Ignore NPE, happens sometimes (only 1s long) when somebody is joining, server switching or disconnecting
@ -223,23 +216,32 @@ public class TablistManager extends BasicListener {
setSlot(i%20, i/20, gray, "§7§l" + server, 1000);
i++;
for (ProxiedPlayer p : players){
boolean sameServer = currentServer == p.getServer().getInfo();
setSlot(i % 20, i / 20, BungeeTabListPlusAPI.getIconFromPlayer(p), getTablistName(p), (sameServer ? 1 : 500));
i++;
}
i = update(currentServer, players, i);
}
while (i < size*20){
setSlot(i%20, i/20, darkGray, "", 1000);
i++;
}
finish(i);
}catch(IndexOutOfBoundsException | NullPointerException e){
//Ignore IndexOutOfBoundsException
//Ignore NPE, happens sometimes (only 1s long) when somebody is joining, server switching or disconnecting
}
}
private int update(ServerInfo currentServer, List<ProxiedPlayer> players, int i) {
for (ProxiedPlayer p : players){
boolean sameServer = currentServer == p.getServer().getInfo();
setSlot(i % 20, i / 20, BungeeTabListPlusAPI.getIconFromPlayer(p), getTablistName(p), (sameServer ? 1 : 500));
i++;
}
return i;
}
private void finish(int i) {
while (i < size*20){
setSlot(i%20, i/20, darkGray, "", 1000);
i++;
}
}
private Team getTeam(ProxiedPlayer p) {
Team team = Team.get(SteamwarUser.get(p).getTeam());
return team.getTeamId() <= 0 ? null : team;