SteamWar/BungeeCore
Archiviert
13
2

More error output

Dieser Commit ist enthalten in:
Lixfel 2019-06-02 21:22:39 +02:00
Ursprung 337118930d
Commit 151292acf2

Datei anzeigen

@ -23,20 +23,22 @@ public class Arena implements Runnable{
private Process p;
private PrintWriter writer;
public ServerInfo server;
private String map;
private boolean started = false;
private final List<ProxiedPlayer> cachedPlayers = new ArrayList<>();
private final List<ProxiedPlayer> players = new ArrayList<>();
public Arena(ArenaMode modus, int id){
public Arena(ArenaMode modus, int id, String map){
spielModus = modus;
arenenNummer = id;
serverName = modus.name() + id;
this.map = map;
int port = 2500 + arenenNummer;
ProcessBuilder pb = new ProcessBuilder(
"/home/minecraft/mc",
"-a", modus.name(), serverName, Integer.toString(port));
"-a", modus.name(), serverName, Integer.toString(port), "Arena");
try{
p = pb.start();
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.instance, this);
@ -78,7 +80,7 @@ public class Arena implements Runnable{
}
}
protected void stop(){
void stop(){
if(p != null && p.isAlive()){
for(ProxiedPlayer player : server.getPlayers()){
player.connect(ProxyServer.getInstance().getServerInfo(BungeeCore.LobbyServer));
@ -95,6 +97,17 @@ public class Arena implements Runnable{
ArenaSystem.arenen.remove(this);
}
private void fatalError(){
for(ProxiedPlayer cached : cachedPlayers){
cached.sendMessage(BungeeCore.ChatPrefix + "§7Unerwarteter Fehler beim Arenenstart");
}
for(ProxiedPlayer player : server.getPlayers()){
player.connect(ProxyServer.getInstance().getServerInfo(BungeeCore.LobbyServer));
player.sendMessage(BungeeCore.ChatPrefix + "§7Unerwarteter Fehler in der Arena");
}
stop();
}
public boolean inArena(ProxiedPlayer p){
for(ProxiedPlayer ap : cachedPlayers)
if(ap.equals(p))
@ -113,11 +126,11 @@ public class Arena implements Runnable{
while (!started && (line = reader.readLine()) != null) {
started = line.contains(" INFO]: Done ("); //Problematisch
//started = line.contains("INFO]: [AAC] AAC has been enabled.");
}
if(line == null){
System.out.println("Fatal error starting arena!");
BungeeCore.log("Arena "+serverName+" stopped to early!");
fatalError();
return;
}
@ -135,8 +148,10 @@ public class Arena implements Runnable{
p.waitFor();
}catch(IOException e){
e.printStackTrace();
fatalError();
}catch(InterruptedException e){
BungeeCore.log("Arena "+serverName+" was interrupted!");
fatalError();
}
stop();
}