geforkt von SteamWar/PersistentBungeeCore
Commits vergleichen
1 Commits
master
...
BetterBauS
Autor | SHA1 | Datum | |
---|---|---|---|
|
24524036a8 |
@ -48,4 +48,10 @@ public class Storage {
|
||||
public static final Map<Integer, ServerInfo> teamServers = new HashMap<>(); // TeamID -> ServerInfo map
|
||||
|
||||
public static final Map<ProxiedPlayer, Map<UUID, PlayerListItem.Item>> directTabItems = new HashMap<>();
|
||||
|
||||
public static final Map<Subserver, String> serverToNodeMap = new HashMap<>();
|
||||
|
||||
public static final Map<String, List<Subserver>> nodeToServerMap = new HashMap<>();
|
||||
|
||||
public static final Map<Subserver, Long> timeOfServerEmpty = new HashMap<>();
|
||||
}
|
||||
|
@ -140,6 +140,7 @@ public class Subserver implements Runnable {
|
||||
if(!process.waitFor(1, TimeUnit.MINUTES))
|
||||
process.destroyForcibly();
|
||||
thread.join();
|
||||
cleanup();
|
||||
}catch(InterruptedException e){
|
||||
logger.log(Level.SEVERE, "Subserver stop interrupted!", e);
|
||||
Thread.currentThread().interrupt();
|
||||
@ -152,12 +153,24 @@ public class Subserver implements Runnable {
|
||||
process.destroy();
|
||||
}
|
||||
thread.join();
|
||||
cleanup();
|
||||
}catch(InterruptedException e){
|
||||
logger.log(Level.SEVERE, "Subserver stop interrupted!", e);
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanup() {
|
||||
String nodeName = Storage.serverToNodeMap.remove(this);
|
||||
if (nodeName != null) {
|
||||
Storage.nodeToServerMap.computeIfPresent(nodeName, (s, list) -> {
|
||||
list.remove(this);
|
||||
if (list.isEmpty()) return null;
|
||||
return list;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static void shutdown(){
|
||||
while (!serverList.isEmpty()) {
|
||||
Subserver server = serverList.get(0);
|
||||
@ -240,4 +253,8 @@ public class Subserver implements Runnable {
|
||||
shutdownCallback.run();
|
||||
}
|
||||
}
|
||||
|
||||
public long getPID() {
|
||||
return process.pid();
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren