geforkt von SteamWar/BungeeCore
🎨 Now?
Dieser Commit ist enthalten in:
Ursprung
081a1d42ff
Commit
f5eaadba4f
@ -37,10 +37,13 @@ public class ServerStarter {
|
||||
private Portrange portrange = BAU_PORTS;
|
||||
private Function<Integer, String> serverNameProvider = port -> node.getName() + port;
|
||||
private BooleanSupplier startCondition = () -> true;
|
||||
private ServerConstructor constructor = (serverName, port, builder, shutdownCallback) -> new Subserver(Servertype.ARENA, serverName, port, builder, shutdownCallback);
|
||||
private Runnable worldSetup = () -> {};
|
||||
private String worldName = null;
|
||||
private Runnable worldCleanup = () -> {};
|
||||
private boolean allowMerge = false;
|
||||
private String fightMap = null;
|
||||
private String gameMode = null;
|
||||
private ServerConstructor constructor = (serverName, port, allowMerge, builder, shutdownCallback) -> new Arenaserver(serverName, gameMode, fightMap, false, port, builder, shutdownCallback);
|
||||
|
||||
private final Set<ProxiedPlayer> playersToSend = new HashSet<>();
|
||||
private final Map<String, String> arguments = new HashMap<>();
|
||||
@ -49,9 +52,11 @@ public class ServerStarter {
|
||||
portrange = ARENA_PORTS;
|
||||
serverNameProvider = port -> mode.getDisplayName() + (port - portrange.start);
|
||||
serverJar = mode.serverJar();
|
||||
allowMerge = true;
|
||||
fightMap = map;
|
||||
gameMode = mode.getInternalName();
|
||||
directory = new File(SERVER_PATH, mode.getFolder());
|
||||
arguments.put("config", mode.getConfig());
|
||||
constructor = (serverName, port, builder, shutdownCallback) -> new Arenaserver(serverName, mode.getInternalName(), map, true, port, builder, shutdownCallback);
|
||||
tempWorld(SERVER_PATH + mode.getFolder() + "/arenas/" + map);
|
||||
return this;
|
||||
}
|
||||
@ -62,7 +67,8 @@ public class ServerStarter {
|
||||
worldDir = EVENT_PATH;
|
||||
worldCleanup = () -> {};
|
||||
arguments.put("fightID", String.valueOf(eventFight.getFightID()));
|
||||
constructor = (serverName, port, builder, shutdownCallback) -> new Arenaserver(serverName, eventFight.getSpielmodus().getInternalName(), eventFight.getMap(), false, port, builder, shutdownCallback);
|
||||
fightMap = eventFight.getMap();
|
||||
gameMode = eventFight.getSpielmodus().getInternalName();
|
||||
|
||||
String serverName = Team.get(eventFight.getTeamBlue()).getTeamKuerzel() + " vs " + Team.get(eventFight.getTeamRed()).getTeamKuerzel();
|
||||
serverNameProvider = port -> serverName;
|
||||
@ -186,7 +192,7 @@ public class ServerStarter {
|
||||
}
|
||||
|
||||
private void build(UUID owner) {
|
||||
constructor = (serverName, port, builder, shutdownCallback) -> new Bauserver(serverName, owner, port, builder, shutdownCallback);
|
||||
constructor = (serverName, port, allowMerge, builder, shutdownCallback) -> new Bauserver(serverName, owner, port, builder, shutdownCallback);
|
||||
serverNameProvider = port -> bauServerName(SteamwarUser.get(owner));
|
||||
}
|
||||
|
||||
@ -210,7 +216,7 @@ public class ServerStarter {
|
||||
worldSetup.run();
|
||||
arguments.put("logPath", worldName);
|
||||
|
||||
Subserver subserver = constructor.construct(serverName, port, node.startServer(
|
||||
Subserver subserver = constructor.construct(serverName, port, allowMerge, node.startServer(
|
||||
serverJar, directory, worldDir, worldName, port, xmx, arguments.entrySet().stream().map(entry -> entry.getKey() + "=" + entry.getValue()).toArray(String[]::new)
|
||||
), worldCleanup);
|
||||
|
||||
@ -243,7 +249,7 @@ public class ServerStarter {
|
||||
}
|
||||
|
||||
private interface ServerConstructor {
|
||||
Subserver construct(String serverName, int port, ProcessBuilder builder, Runnable shutdownCallback);
|
||||
Subserver construct(String serverName, int port, boolean merge, ProcessBuilder builder, Runnable shutdownCallback);
|
||||
}
|
||||
|
||||
private static class Portrange {
|
||||
|
@ -71,7 +71,7 @@ public class ChallengeCommand extends BasicCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
FightCommand.createArena(sender, "/challenge " + target.getName() + " ", true, args, 1, false, (player, mode, map) -> {
|
||||
FightCommand.createArena(sender, "/challenge " + target.getName() + " ", false, args, 1, false, (player, mode, map) -> {
|
||||
if(challenges.containsKey(target) && challenges.get(target).contains(player)){
|
||||
challenges.remove(target);
|
||||
challenges.remove(player);
|
||||
|
@ -168,9 +168,7 @@ public class FightCommand extends BasicCommand {
|
||||
if(map == null)
|
||||
return;
|
||||
|
||||
if(!allowMerging) {
|
||||
callback.run(player, mode, map);
|
||||
} else if(suggestMerging(player, mode, map, callback)) {
|
||||
if(!allowMerging || suggestMerging(player, mode, map, callback)) {
|
||||
callback.run(player, mode, map);
|
||||
}
|
||||
}
|
||||
@ -189,28 +187,29 @@ public class FightCommand extends BasicCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if(mergable != null) {
|
||||
SWInventory inventory = new SWInventory(player, 9, Message.parse("FIGHT_MERGE_TITLE", player));
|
||||
inventory.addItem(0, new SWItem(Message.parse("FIGHT_MERGE_DECLINE", player), 1), click -> {
|
||||
inventory.close();
|
||||
declineMerge.run(player, mode, map);
|
||||
});
|
||||
Arenaserver finalMergable = mergable;
|
||||
SWItem item = new SWItem(Message.parse("FIGHT_MERGE_INFO", player, mode.getDisplayName(), finalMergable.getMap()), 11);
|
||||
item.addLore(Message.parse("FIGHT_MERGE_INFO_LORE_1", player, finalMergable.getServer().getPlayers().stream().map(ProxiedPlayer::getDisplayName).reduce((player1, player2) -> player1 + ", " + player2).orElse("Error?")));
|
||||
inventory.addItem(4, item, click -> {});
|
||||
inventory.addItem(8, new SWItem(Message.parse("FIGHT_MERGE_ACCEPT", player), 10), click -> {
|
||||
if(Subserver.getServerList().contains(finalMergable)) {
|
||||
finalMergable.sendPlayer(player);
|
||||
} else {
|
||||
Message.send("FIGHT_MERGE_OFFLINE", player);
|
||||
declineMerge.run(player, mode, map);
|
||||
}
|
||||
});
|
||||
inventory.open();
|
||||
return false;
|
||||
if(mergable == null) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
|
||||
SWInventory inventory = new SWInventory(player, 9, Message.parse("FIGHT_MERGE_TITLE", player));
|
||||
inventory.addItem(0, new SWItem(Message.parse("FIGHT_MERGE_DECLINE", player), 1), click -> {
|
||||
inventory.close();
|
||||
declineMerge.run(player, mode, map);
|
||||
});
|
||||
Arenaserver finalMergable = mergable;
|
||||
SWItem item = new SWItem(Message.parse("FIGHT_MERGE_INFO", player, mode.getDisplayName(), finalMergable.getMap()), 11);
|
||||
item.addLore(Message.parse("FIGHT_MERGE_INFO_LORE_1", player, finalMergable.getServer().getPlayers().toArray(new ProxiedPlayer[1])[0].getName()));
|
||||
inventory.addItem(4, item, click -> {});
|
||||
inventory.addItem(8, new SWItem(Message.parse("FIGHT_MERGE_ACCEPT", player), 10), click -> {
|
||||
if(Subserver.getServerList().contains(finalMergable)) {
|
||||
finalMergable.sendPlayer(player);
|
||||
} else {
|
||||
Message.send("FIGHT_MERGE_OFFLINE", player);
|
||||
declineMerge.run(player, mode, map);
|
||||
}
|
||||
});
|
||||
inventory.open();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -597,9 +597,9 @@ MODIFICATION_BAN_LOG={0} hat probiert den Fabric Mod Sender zu editieren / umzug
|
||||
MODIFICATION_CHECK_SUCCESS=§eDeine Mods wurden geprüft und du darfst nun auf Arenen joinen!
|
||||
|
||||
#Arena Merging
|
||||
FIGHT_MERGE_TITLE=Gleicher Fight gefunden!
|
||||
FIGHT_MERGE_TITLE=Gleicher Kampf gefunden!
|
||||
FIGHT_MERGE_DECLINE=Neue Arena starten
|
||||
FIGHT_MERGE_ACCEPT=Fight beitreten
|
||||
FIGHT_MERGE_INFO_LORE_1=§7Von: §e{0}
|
||||
FIGHT_MERGE_OFFLINE=Der Server dem du beitreten wolltest ist nicht mehr online
|
||||
FIGHT_MERGE_INFO=§e{0}§7: §e{1}
|
||||
FIGHT_MERGE_ACCEPT=Kampf beitreten
|
||||
FIGHT_MERGE_INFO_LORE_1=§8Von: §e{0}
|
||||
FIGHT_MERGE_OFFLINE=§7Die vorgeschlagene Arena wurde in der Zwischenzeit beendet, es wird eine neue Arena gestartet.
|
||||
FIGHT_MERGE_INFO=§e{0}§8: §e{1}
|
In neuem Issue referenzieren
Einen Benutzer sperren