13
0

Fix synchronisation issues

Dieser Commit ist enthalten in:
Lixfel 2021-09-11 17:12:41 +02:00
Ursprung ad94e77042
Commit 8acdd3cb7f

Datei anzeigen

@ -46,16 +46,20 @@ public class Subserver implements Runnable {
private static final Logger logger = ProxyServer.getInstance().getLogger();
public static Subserver getSubserver(ProxiedPlayer p){
for(int i = serverList.size()-1; i >= 0; i--){
if(serverList.get(i).onServer(p))
return serverList.get(i);
synchronized (serverList) {
for(int i = serverList.size()-1; i >= 0; i--){
if(serverList.get(i).onServer(p))
return serverList.get(i);
}
}
return null;
}
public static Subserver getSubserver(ServerInfo server){
for(Subserver s : serverList)
if(s.server == server)
return s;
synchronized (serverList) {
for(Subserver s : serverList)
if(s.server == server)
return s;
}
return null;
}
public static List<Subserver> getServerList(){
@ -179,7 +183,9 @@ public class Subserver implements Runnable {
public void run(){
ProxyServer.getInstance().getServers().put(serverName, server);
serverList.add(this);
synchronized (serverList) {
serverList.add(this);
}
try(BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))){
String line = "";