Merge pull request 'Configurable spectate port' (#418) from configurableSpectatePort into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #418 Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
5394adfd14
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren