geforkt von SteamWar/BungeeCore
More error output
Dieser Commit ist enthalten in:
Ursprung
337118930d
Commit
151292acf2
@ -23,20 +23,22 @@ public class Arena implements Runnable{
|
|||||||
private Process p;
|
private Process p;
|
||||||
private PrintWriter writer;
|
private PrintWriter writer;
|
||||||
public ServerInfo server;
|
public ServerInfo server;
|
||||||
|
private String map;
|
||||||
private boolean started = false;
|
private boolean started = false;
|
||||||
|
|
||||||
private final List<ProxiedPlayer> cachedPlayers = new ArrayList<>();
|
private final List<ProxiedPlayer> cachedPlayers = new ArrayList<>();
|
||||||
private final List<ProxiedPlayer> players = 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;
|
spielModus = modus;
|
||||||
arenenNummer = id;
|
arenenNummer = id;
|
||||||
serverName = modus.name() + id;
|
serverName = modus.name() + id;
|
||||||
|
this.map = map;
|
||||||
int port = 2500 + arenenNummer;
|
int port = 2500 + arenenNummer;
|
||||||
ProcessBuilder pb = new ProcessBuilder(
|
ProcessBuilder pb = new ProcessBuilder(
|
||||||
"/home/minecraft/mc",
|
"/home/minecraft/mc",
|
||||||
"-a", modus.name(), serverName, Integer.toString(port));
|
"-a", modus.name(), serverName, Integer.toString(port), "Arena");
|
||||||
try{
|
try{
|
||||||
p = pb.start();
|
p = pb.start();
|
||||||
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.instance, this);
|
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()){
|
if(p != null && p.isAlive()){
|
||||||
for(ProxiedPlayer player : server.getPlayers()){
|
for(ProxiedPlayer player : server.getPlayers()){
|
||||||
player.connect(ProxyServer.getInstance().getServerInfo(BungeeCore.LobbyServer));
|
player.connect(ProxyServer.getInstance().getServerInfo(BungeeCore.LobbyServer));
|
||||||
@ -95,6 +97,17 @@ public class Arena implements Runnable{
|
|||||||
ArenaSystem.arenen.remove(this);
|
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){
|
public boolean inArena(ProxiedPlayer p){
|
||||||
for(ProxiedPlayer ap : cachedPlayers)
|
for(ProxiedPlayer ap : cachedPlayers)
|
||||||
if(ap.equals(p))
|
if(ap.equals(p))
|
||||||
@ -113,11 +126,11 @@ public class Arena implements Runnable{
|
|||||||
|
|
||||||
while (!started && (line = reader.readLine()) != null) {
|
while (!started && (line = reader.readLine()) != null) {
|
||||||
started = line.contains(" INFO]: Done ("); //Problematisch
|
started = line.contains(" INFO]: Done ("); //Problematisch
|
||||||
//started = line.contains("INFO]: [AAC] AAC has been enabled.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(line == null){
|
if(line == null){
|
||||||
System.out.println("Fatal error starting arena!");
|
BungeeCore.log("Arena "+serverName+" stopped to early!");
|
||||||
|
fatalError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,8 +148,10 @@ public class Arena implements Runnable{
|
|||||||
p.waitFor();
|
p.waitFor();
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
fatalError();
|
||||||
}catch(InterruptedException e){
|
}catch(InterruptedException e){
|
||||||
BungeeCore.log("Arena "+serverName+" was interrupted!");
|
BungeeCore.log("Arena "+serverName+" was interrupted!");
|
||||||
|
fatalError();
|
||||||
}
|
}
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren