geforkt von SteamWar/BungeeCore
Fixing NPE
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
861d87e259
Commit
771ad5575d
@ -9,6 +9,7 @@ import de.steamwar.bungeecore.Subserver;
|
|||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
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.PlayerDisconnectEvent;
|
||||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
@ -79,41 +80,41 @@ public class TablistManager extends BasicListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void updateCustomTablist(){
|
private synchronized void updateCustomTablist(){
|
||||||
try{
|
calcHeader();
|
||||||
calcHeader();
|
|
||||||
|
|
||||||
//Calculate server-player-map
|
//Calculate server-player-map
|
||||||
playerMap.clear();
|
playerMap.clear();
|
||||||
for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){
|
for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){
|
||||||
ServerInfo server = player.getServer().getInfo();
|
Server pserver = player.getServer();
|
||||||
String serverName = server.getName();
|
if(pserver == null) //Happens temporarily
|
||||||
if(serverName.equals("Developer"))
|
continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
Subserver subserver = Subserver.getSubserver(server);
|
ServerInfo server = pserver.getInfo();
|
||||||
List<ProxiedPlayer> players;
|
String serverName = server.getName();
|
||||||
if(subserver != null && subserver.getType() == Servertype.BAUSERVER){
|
if(serverName.equals("Developer"))
|
||||||
players = playerMap.getOrDefault("Bau", new ArrayList<>());
|
continue;
|
||||||
players.add(player);
|
|
||||||
playerMap.putIfAbsent("Bau", players);
|
Subserver subserver = Subserver.getSubserver(server);
|
||||||
}else{
|
List<ProxiedPlayer> players;
|
||||||
players = playerMap.getOrDefault(serverName, new ArrayList<>());
|
if(subserver != null && subserver.getType() == Servertype.BAUSERVER){
|
||||||
players.add(player);
|
players = playerMap.getOrDefault("Bau", new ArrayList<>());
|
||||||
playerMap.putIfAbsent(serverName, players);
|
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
|
@EventHandler
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren