diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/Config.java b/FightSystem_Core/src/de/steamwar/fightsystem/Config.java index 042f158..d58ebbb 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/Config.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/Config.java @@ -138,10 +138,14 @@ public class Config { //replay system parameter public static final String spectateIP = "127.0.0.1"; - public static final int spectatePort = 2222; + public static final int SpectatePort; public static final int ReplayID; static{ + CheckSchemID = Integer.parseInt(System.getProperty("checkSchemID", "0")); + PrepareSchemID = Integer.parseInt(System.getProperty("prepareSchemID", "0")); + ReplayID = Integer.parseInt(System.getProperty("replay", "0")); + String configFile = System.getProperty("config", "config.yml"); if(!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) { FightSystem.getPlugin().saveDefaultConfig(); @@ -340,6 +344,8 @@ public class Config { EventTeamBlueID = team1.getTeamId(); EventTeamRedID = team2.getTeamId(); BothTeamsPublic = EventTeamRedID == 0 && EventTeamBlueID == 0; + SpectatePort = EventKampf.getSpectatePort(); + LiveReplay = SpectatePort != 0; Referees = Referee.get(Config.EventKampf.getEventID()); Event event = Event.get(EventKampf.getEventID()); @@ -350,7 +356,6 @@ public class Config { OnlyPublicSchematics = event.publicSchemsOnly(); MaximumTeamMembers = event.getMaximumTeamMembers(); } - LiveReplay = event.spectateSystem(); }else{ //No event TeamRedColor = config.getString("Red.Prefix", "§c"); @@ -365,6 +370,7 @@ public class Config { Referees = Collections.emptySet(); MaximumTeamMembers = Integer.MAX_VALUE; LiveReplay = false; + SpectatePort = -ReplayID; } String blueLeader = System.getProperty("blueLeader", null); @@ -378,10 +384,6 @@ public class Config { else RedLeader = null; - CheckSchemID = Integer.parseInt(System.getProperty("checkSchemID", "0")); - PrepareSchemID = Integer.parseInt(System.getProperty("prepareSchemID", "0")); - ReplayID = Integer.parseInt(System.getProperty("replay", "0")); - if(CheckSchemID != 0){ mode = ArenaMode.CHECK; }else if(PrepareSchemID != 0){ @@ -401,7 +403,7 @@ public class Config { return ArenaMode.Test.contains(mode); } public static boolean replayserver(){ - return ReplayID == -1; + return ReplayID < 0; } public static boolean blueNegZ(){ return BlueToRedZ > 0; diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/record/LiveRecorder.java b/FightSystem_Core/src/de/steamwar/fightsystem/record/LiveRecorder.java index b7531d3..55fef03 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/record/LiveRecorder.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/record/LiveRecorder.java @@ -41,7 +41,7 @@ public class LiveRecorder extends StateDependent implements Recorder { @Override public void enable() { try { - socket = new Socket(Config.spectateIP, Config.spectatePort); + socket = new Socket(Config.spectateIP, Config.SpectatePort); socket.setSoTimeout(1); // Wait a maximum of 1ms on a blocking operation (flush) socket.setSoLinger(true, 1); // Wait a maximum of 1ms on disable socket.setTcpNoDelay(true); // Don't wait on ack diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/record/LiveServer.java b/FightSystem_Core/src/de/steamwar/fightsystem/record/LiveServer.java index b58f0fa..5bb6308 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/record/LiveServer.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/record/LiveServer.java @@ -33,7 +33,7 @@ public class LiveServer { private final ServerSocket socket; public LiveServer() throws IOException { - socket = new ServerSocket(Config.spectatePort); + socket = new ServerSocket(Config.SpectatePort); Bukkit.getScheduler().runTaskAsynchronously(FightSystem.getPlugin(), this::acceptConnections); }