SteamWar/BungeeCore
Archiviert
13
2

Adding shutdown hooks

Dieser Commit ist enthalten in:
Lixfel 2019-12-16 09:55:01 +01:00
Ursprung 439ef96bac
Commit f16601ea0f

Datei anzeigen

@ -30,12 +30,19 @@ public class SubserverSystem {
public static Subserver startArena(ArenaMode modus, String map){ public static Subserver startArena(ArenaMode modus, String map){
int port = freePort(2500); int port = freePort(2500);
String serverName = modus.getDisplayName() + (port - 2500); String serverName = modus.getDisplayName() + (port - 2500);
return new Subserver(Servertype.ARENA, serverName, port,
MC_SCRIPT, "-a", modus.getInternalName(), serverName, Integer.toString(port), map, "0", modus.serverJar()); return new Subserver(Servertype.ARENA, serverName, port, () -> {
try {
new ProcessBuilder("rm", "-r", "~/backbone/arenaserver/" + serverName).start();
} catch (IOException e) {
throw new SecurityException("Could not clean up folder", e);
}
}, MC_SCRIPT, "-a", modus.getInternalName(), serverName, Integer.toString(port), map, "0", modus.serverJar());
} }
public static Subserver startEventArena(EventFight eventFight, String serverName){ public static Subserver startEventArena(EventFight eventFight, String serverName){
int port = freePort(2500); int port = freePort(2500);
return new Subserver(Servertype.ARENA, serverName, port, return new Subserver(Servertype.ARENA, serverName, port,
MC_SCRIPT, "-a", eventFight.getSpielmodus().getInternalName(), serverName.replace(' ', '_') + eventFight.getStartTime().toLocalDateTime().format(EventCommand.TIME_FORMAT), Integer.toString(port), eventFight.getMap(), Integer.toString(eventFight.getFightID()), eventFight.getSpielmodus().serverJar()); MC_SCRIPT, "-a", eventFight.getSpielmodus().getInternalName(), serverName.replace(' ', '_') + eventFight.getStartTime().toLocalDateTime().format(EventCommand.TIME_FORMAT), Integer.toString(port), eventFight.getMap(), Integer.toString(eventFight.getFightID()), eventFight.getSpielmodus().serverJar());
} }
@ -43,8 +50,13 @@ public class SubserverSystem {
public static void sendToTestServer(ProxiedPlayer p, ArenaMode m, String map){ public static void sendToTestServer(ProxiedPlayer p, ArenaMode m, String map){
int port = freePort(4000); int port = freePort(4000);
new Bauserver(p.getName() + "s Bau", p.getUniqueId(), port, new Bauserver(p.getName() + "s Bau", p.getUniqueId(), port, () -> {
MC_SCRIPT, "-a", m.getInternalName(), p.getName(), Integer.toString(port), map, "-1", m.serverJar()).sendPlayer(p); try {
new ProcessBuilder("rm", "-r", "~/backbone/arenaserver/" + p.getName()).start();
} catch (IOException e) {
throw new SecurityException("Could not clean up folder", e);
}
}, MC_SCRIPT, "-a", m.getInternalName(), p.getName(), Integer.toString(port), map, "-1", m.serverJar()).sendPlayer(p);
} }
public static void sendToBauServer(ProxiedPlayer p, UUID owner){ public static void sendToBauServer(ProxiedPlayer p, UUID owner){