Configurable spectate port #418
@ -138,10 +138,14 @@ public class Config {
|
|||||||
|
|
||||||
//replay system parameter
|
//replay system parameter
|
||||||
public static final String spectateIP = "127.0.0.1";
|
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;
|
public static final int ReplayID;
|
||||||
|
|
||||||
static{
|
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");
|
String configFile = System.getProperty("config", "config.yml");
|
||||||
if(!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) {
|
if(!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) {
|
||||||
FightSystem.getPlugin().saveDefaultConfig();
|
FightSystem.getPlugin().saveDefaultConfig();
|
||||||
@ -340,6 +344,8 @@ public class Config {
|
|||||||
EventTeamBlueID = team1.getTeamId();
|
EventTeamBlueID = team1.getTeamId();
|
||||||
EventTeamRedID = team2.getTeamId();
|
EventTeamRedID = team2.getTeamId();
|
||||||
BothTeamsPublic = EventTeamRedID == 0 && EventTeamBlueID == 0;
|
BothTeamsPublic = EventTeamRedID == 0 && EventTeamBlueID == 0;
|
||||||
|
SpectatePort = EventKampf.getSpectatePort();
|
||||||
|
LiveReplay = SpectatePort != 0;
|
||||||
Referees = Referee.get(Config.EventKampf.getEventID());
|
Referees = Referee.get(Config.EventKampf.getEventID());
|
||||||
|
|
||||||
Event event = Event.get(EventKampf.getEventID());
|
Event event = Event.get(EventKampf.getEventID());
|
||||||
@ -350,7 +356,6 @@ public class Config {
|
|||||||
OnlyPublicSchematics = event.publicSchemsOnly();
|
OnlyPublicSchematics = event.publicSchemsOnly();
|
||||||
MaximumTeamMembers = event.getMaximumTeamMembers();
|
MaximumTeamMembers = event.getMaximumTeamMembers();
|
||||||
}
|
}
|
||||||
LiveReplay = event.spectateSystem();
|
|
||||||
}else{
|
}else{
|
||||||
//No event
|
//No event
|
||||||
TeamRedColor = config.getString("Red.Prefix", "§c");
|
TeamRedColor = config.getString("Red.Prefix", "§c");
|
||||||
@ -365,6 +370,7 @@ public class Config {
|
|||||||
Referees = Collections.emptySet();
|
Referees = Collections.emptySet();
|
||||||
MaximumTeamMembers = Integer.MAX_VALUE;
|
MaximumTeamMembers = Integer.MAX_VALUE;
|
||||||
LiveReplay = false;
|
LiveReplay = false;
|
||||||
|
SpectatePort = -ReplayID;
|
||||||
}
|
}
|
||||||
|
|
||||||
String blueLeader = System.getProperty("blueLeader", null);
|
String blueLeader = System.getProperty("blueLeader", null);
|
||||||
@ -378,10 +384,6 @@ public class Config {
|
|||||||
else
|
else
|
||||||
RedLeader = null;
|
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){
|
if(CheckSchemID != 0){
|
||||||
mode = ArenaMode.CHECK;
|
mode = ArenaMode.CHECK;
|
||||||
}else if(PrepareSchemID != 0){
|
}else if(PrepareSchemID != 0){
|
||||||
@ -401,7 +403,7 @@ public class Config {
|
|||||||
return ArenaMode.Test.contains(mode);
|
return ArenaMode.Test.contains(mode);
|
||||||
}
|
}
|
||||||
public static boolean replayserver(){
|
public static boolean replayserver(){
|
||||||
return ReplayID == -1;
|
return ReplayID < 0;
|
||||||
}
|
}
|
||||||
public static boolean blueNegZ(){
|
public static boolean blueNegZ(){
|
||||||
return BlueToRedZ > 0;
|
return BlueToRedZ > 0;
|
||||||
|
@ -41,7 +41,7 @@ public class LiveRecorder extends StateDependent implements Recorder {
|
|||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
try {
|
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.setSoTimeout(1); // Wait a maximum of 1ms on a blocking operation (flush)
|
||||||
socket.setSoLinger(true, 1); // Wait a maximum of 1ms on disable
|
socket.setSoLinger(true, 1); // Wait a maximum of 1ms on disable
|
||||||
socket.setTcpNoDelay(true); // Don't wait on ack
|
socket.setTcpNoDelay(true); // Don't wait on ack
|
||||||
|
@ -33,7 +33,7 @@ public class LiveServer {
|
|||||||
private final ServerSocket socket;
|
private final ServerSocket socket;
|
||||||
|
|
||||||
public LiveServer() throws IOException {
|
public LiveServer() throws IOException {
|
||||||
socket = new ServerSocket(Config.spectatePort);
|
socket = new ServerSocket(Config.SpectatePort);
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(FightSystem.getPlugin(), this::acceptConnections);
|
Bukkit.getScheduler().runTaskAsynchronously(FightSystem.getPlugin(), this::acceptConnections);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren