Archiviert
1
0
Dieser Commit ist enthalten in:
Chaoscaot 2022-04-16 16:13:10 +02:00
Ursprung f5eaadba4f
Commit d854621752
2 geänderte Dateien mit 10 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -43,7 +43,7 @@ public class ServerStarter {
private boolean allowMerge = false; private boolean allowMerge = false;
private String fightMap = null; private String fightMap = null;
private String gameMode = null; private String gameMode = null;
private ServerConstructor constructor = (serverName, port, allowMerge, builder, shutdownCallback) -> new Arenaserver(serverName, gameMode, fightMap, false, port, builder, shutdownCallback); private ServerConstructor constructor = (serverName, port, builder, shutdownCallback) -> new Arenaserver(serverName, gameMode, fightMap, allowMerge, port, builder, shutdownCallback);
private final Set<ProxiedPlayer> playersToSend = new HashSet<>(); private final Set<ProxiedPlayer> playersToSend = new HashSet<>();
private final Map<String, String> arguments = new HashMap<>(); private final Map<String, String> arguments = new HashMap<>();
@ -192,7 +192,7 @@ public class ServerStarter {
} }
private void build(UUID owner) { private void build(UUID owner) {
constructor = (serverName, port, allowMerge, builder, shutdownCallback) -> new Bauserver(serverName, owner, port, builder, shutdownCallback); constructor = (serverName, port, builder, shutdownCallback) -> new Bauserver(serverName, owner, port, builder, shutdownCallback);
serverNameProvider = port -> bauServerName(SteamwarUser.get(owner)); serverNameProvider = port -> bauServerName(SteamwarUser.get(owner));
} }
@ -216,7 +216,7 @@ public class ServerStarter {
worldSetup.run(); worldSetup.run();
arguments.put("logPath", worldName); arguments.put("logPath", worldName);
Subserver subserver = constructor.construct(serverName, port, allowMerge, node.startServer( Subserver subserver = constructor.construct(serverName, port, node.startServer(
serverJar, directory, worldDir, worldName, port, xmx, arguments.entrySet().stream().map(entry -> entry.getKey() + "=" + entry.getValue()).toArray(String[]::new) serverJar, directory, worldDir, worldName, port, xmx, arguments.entrySet().stream().map(entry -> entry.getKey() + "=" + entry.getValue()).toArray(String[]::new)
), worldCleanup); ), worldCleanup);
@ -249,7 +249,7 @@ public class ServerStarter {
} }
private interface ServerConstructor { private interface ServerConstructor {
Subserver construct(String serverName, int port, boolean merge, ProcessBuilder builder, Runnable shutdownCallback); Subserver construct(String serverName, int port, ProcessBuilder builder, Runnable shutdownCallback);
} }
private static class Portrange { private static class Portrange {

Datei anzeigen

@ -168,12 +168,14 @@ public class FightCommand extends BasicCommand {
if(map == null) if(map == null)
return; return;
if(!allowMerging || suggestMerging(player, mode, map, callback)) { if(!allowMerging) {
callback.run(player, mode, map); callback.run(player, mode, map);
} else {
suggestMerging(player, mode, map, callback);
} }
} }
public static boolean suggestMerging(ProxiedPlayer player, ArenaMode mode, String map, FightCallback declineMerge) { public static void suggestMerging(ProxiedPlayer player, ArenaMode mode, String map, FightCallback declineMerge) {
Arenaserver mergable = null; Arenaserver mergable = null;
synchronized (Subserver.getServerList()) { synchronized (Subserver.getServerList()) {
for (Subserver subserver : Subserver.getServerList()) { for (Subserver subserver : Subserver.getServerList()) {
@ -188,7 +190,8 @@ public class FightCommand extends BasicCommand {
} }
if(mergable == null) { if(mergable == null) {
return true; declineMerge.run(player, mode, map);
return;
} }
SWInventory inventory = new SWInventory(player, 9, Message.parse("FIGHT_MERGE_TITLE", player)); SWInventory inventory = new SWInventory(player, 9, Message.parse("FIGHT_MERGE_TITLE", player));
@ -209,7 +212,6 @@ public class FightCommand extends BasicCommand {
} }
}); });
inventory.open(); inventory.open();
return false;
} }
@Override @Override