SteamWar/BungeeCore
Archiviert
13
2

🎨 Now?
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaoscaot 2022-04-06 18:33:44 +02:00
Ursprung 081a1d42ff
Commit f5eaadba4f
4 geänderte Dateien mit 41 neuen und 36 gelöschten Zeilen

Datei anzeigen

@ -37,10 +37,13 @@ public class ServerStarter {
private Portrange portrange = BAU_PORTS; private Portrange portrange = BAU_PORTS;
private Function<Integer, String> serverNameProvider = port -> node.getName() + port; private Function<Integer, String> serverNameProvider = port -> node.getName() + port;
private BooleanSupplier startCondition = () -> true; private BooleanSupplier startCondition = () -> true;
private ServerConstructor constructor = (serverName, port, builder, shutdownCallback) -> new Subserver(Servertype.ARENA, serverName, port, builder, shutdownCallback);
private Runnable worldSetup = () -> {}; private Runnable worldSetup = () -> {};
private String worldName = null; private String worldName = null;
private Runnable worldCleanup = () -> {}; 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 Set<ProxiedPlayer> playersToSend = new HashSet<>();
private final Map<String, String> arguments = new HashMap<>(); private final Map<String, String> arguments = new HashMap<>();
@ -49,9 +52,11 @@ public class ServerStarter {
portrange = ARENA_PORTS; portrange = ARENA_PORTS;
serverNameProvider = port -> mode.getDisplayName() + (port - portrange.start); serverNameProvider = port -> mode.getDisplayName() + (port - portrange.start);
serverJar = mode.serverJar(); serverJar = mode.serverJar();
allowMerge = true;
fightMap = map;
gameMode = mode.getInternalName();
directory = new File(SERVER_PATH, mode.getFolder()); directory = new File(SERVER_PATH, mode.getFolder());
arguments.put("config", mode.getConfig()); 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); tempWorld(SERVER_PATH + mode.getFolder() + "/arenas/" + map);
return this; return this;
} }
@ -62,7 +67,8 @@ public class ServerStarter {
worldDir = EVENT_PATH; worldDir = EVENT_PATH;
worldCleanup = () -> {}; worldCleanup = () -> {};
arguments.put("fightID", String.valueOf(eventFight.getFightID())); 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(); String serverName = Team.get(eventFight.getTeamBlue()).getTeamKuerzel() + " vs " + Team.get(eventFight.getTeamRed()).getTeamKuerzel();
serverNameProvider = port -> serverName; serverNameProvider = port -> serverName;
@ -186,7 +192,7 @@ public class ServerStarter {
} }
private void build(UUID owner) { 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)); serverNameProvider = port -> bauServerName(SteamwarUser.get(owner));
} }
@ -210,7 +216,7 @@ public class ServerStarter {
worldSetup.run(); worldSetup.run();
arguments.put("logPath", worldName); 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) serverJar, directory, worldDir, worldName, port, xmx, arguments.entrySet().stream().map(entry -> entry.getKey() + "=" + entry.getValue()).toArray(String[]::new)
), worldCleanup); ), worldCleanup);
@ -243,7 +249,7 @@ public class ServerStarter {
} }
private interface ServerConstructor { 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 { private static class Portrange {

Datei anzeigen

@ -71,7 +71,7 @@ public class ChallengeCommand extends BasicCommand {
return; 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)){ if(challenges.containsKey(target) && challenges.get(target).contains(player)){
challenges.remove(target); challenges.remove(target);
challenges.remove(player); challenges.remove(player);

Datei anzeigen

@ -168,9 +168,7 @@ public class FightCommand extends BasicCommand {
if(map == null) if(map == null)
return; return;
if(!allowMerging) { if(!allowMerging || suggestMerging(player, mode, map, callback)) {
callback.run(player, mode, map);
} else if(suggestMerging(player, mode, map, callback)) {
callback.run(player, mode, map); callback.run(player, mode, map);
} }
} }
@ -189,7 +187,10 @@ public class FightCommand extends BasicCommand {
} }
} }
if(mergable != null) { if(mergable == null) {
return true;
}
SWInventory inventory = new SWInventory(player, 9, Message.parse("FIGHT_MERGE_TITLE", player)); 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.addItem(0, new SWItem(Message.parse("FIGHT_MERGE_DECLINE", player), 1), click -> {
inventory.close(); inventory.close();
@ -197,7 +198,7 @@ public class FightCommand extends BasicCommand {
}); });
Arenaserver finalMergable = mergable; Arenaserver finalMergable = mergable;
SWItem item = new SWItem(Message.parse("FIGHT_MERGE_INFO", player, mode.getDisplayName(), finalMergable.getMap()), 11); 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?"))); 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(4, item, click -> {});
inventory.addItem(8, new SWItem(Message.parse("FIGHT_MERGE_ACCEPT", player), 10), click -> { inventory.addItem(8, new SWItem(Message.parse("FIGHT_MERGE_ACCEPT", player), 10), click -> {
if(Subserver.getServerList().contains(finalMergable)) { if(Subserver.getServerList().contains(finalMergable)) {
@ -210,8 +211,6 @@ public class FightCommand extends BasicCommand {
inventory.open(); inventory.open();
return false; return false;
} }
return true;
}
@Override @Override
public void execute(CommandSender sender, String[] args) { public void execute(CommandSender sender, String[] args) {

Datei anzeigen

@ -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! MODIFICATION_CHECK_SUCCESS=§eDeine Mods wurden geprüft und du darfst nun auf Arenen joinen!
#Arena Merging #Arena Merging
FIGHT_MERGE_TITLE=Gleicher Fight gefunden! FIGHT_MERGE_TITLE=Gleicher Kampf gefunden!
FIGHT_MERGE_DECLINE=Neue Arena starten FIGHT_MERGE_DECLINE=Neue Arena starten
FIGHT_MERGE_ACCEPT=Fight beitreten FIGHT_MERGE_ACCEPT=Kampf beitreten
FIGHT_MERGE_INFO_LORE_1=§7Von: §e{0} FIGHT_MERGE_INFO_LORE_1=§8Von: §e{0}
FIGHT_MERGE_OFFLINE=Der Server dem du beitreten wolltest ist nicht mehr online FIGHT_MERGE_OFFLINE=§7Die vorgeschlagene Arena wurde in der Zwischenzeit beendet, es wird eine neue Arena gestartet.
FIGHT_MERGE_INFO=§e{0}§7: §e{1} FIGHT_MERGE_INFO=§e{0}§8: §e{1}