Archiviert
1
0
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-04-30 15:08:51 +02:00
Ursprung 861d87e259
Commit 771ad5575d

Datei anzeigen

@ -9,6 +9,7 @@ import de.steamwar.bungeecore.Subserver;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.connection.Server;
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.event.EventHandler;
@ -79,41 +80,41 @@ public class TablistManager extends BasicListener {
}
private synchronized void updateCustomTablist(){
try{
calcHeader();
calcHeader();
//Calculate server-player-map
playerMap.clear();
for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){
ServerInfo server = player.getServer().getInfo();
String serverName = server.getName();
if(serverName.equals("Developer"))
continue;
//Calculate server-player-map
playerMap.clear();
for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){
Server pserver = player.getServer();
if(pserver == null) //Happens temporarily
continue;
Subserver subserver = Subserver.getSubserver(server);
List<ProxiedPlayer> players;
if(subserver != null && subserver.getType() == Servertype.BAUSERVER){
players = playerMap.getOrDefault("Bau", new ArrayList<>());
players.add(player);
playerMap.putIfAbsent("Bau", players);
}else{
players = playerMap.getOrDefault(serverName, new ArrayList<>());
players.add(player);
playerMap.putIfAbsent(serverName, players);
}
ServerInfo server = pserver.getInfo();
String serverName = server.getName();
if(serverName.equals("Developer"))
continue;
Subserver subserver = Subserver.getSubserver(server);
List<ProxiedPlayer> players;
if(subserver != null && subserver.getType() == Servertype.BAUSERVER){
players = playerMap.getOrDefault("Bau", new ArrayList<>());
players.add(player);
playerMap.putIfAbsent("Bau", players);
}else{
players = playerMap.getOrDefault(serverName, new ArrayList<>());
players.add(player);
playerMap.putIfAbsent(serverName, players);
}
playerMap.forEach((server, players) -> players.sort((proxiedPlayer, t1) -> proxiedPlayer.getName().compareToIgnoreCase(t1.getName())));
//Set size
calculateSize();
for(Tablist tablist : tablists.values())
tablist.refresh();
seconds++;
}catch(NullPointerException e){
ProxyServer.getInstance().getLogger().log(Level.SEVERE, "NPE", e);
}
playerMap.forEach((server, players) -> players.sort((proxiedPlayer, t1) -> proxiedPlayer.getName().compareToIgnoreCase(t1.getName())));
//Set size
calculateSize();
for(Tablist tablist : tablists.values())
tablist.refresh();
seconds++;
}
@EventHandler