geforkt von SteamWar/BungeeCore
Adding 1.15-Testbauserver support
Dieser Commit ist enthalten in:
Ursprung
312f5b96b7
Commit
31862fe31d
@ -39,6 +39,8 @@ public class BungeeCore extends Plugin {
|
||||
public static String WORLD_FOLDER;
|
||||
public static String BAUWELT_PROTOTYP;
|
||||
public static String LOBBY_SERVER;
|
||||
public static String USERWORLDS15;
|
||||
public static String BAUWELT15;
|
||||
|
||||
private static BungeeCore instance;
|
||||
|
||||
@ -182,6 +184,8 @@ public class BungeeCore extends Plugin {
|
||||
WORLD_FOLDER = config.getString("worldfolder");
|
||||
BAUWELT_PROTOTYP = config.getString("bauweltprototyp");
|
||||
LOBBY_SERVER = config.getString("lobbyserver");
|
||||
USERWORLDS15 = config.getString("userworlds15");
|
||||
BAUWELT15 = config.getString("bauwelt15");
|
||||
Broadcaster.setBroadCastMsgs(config.getStringList("broadcasts").toArray(new String[1]));
|
||||
PollSystem.init(config.getString("poll.question"), config.getStringList("poll.answers"));
|
||||
Persistent.setChatPrefix(CHAT_PREFIX);
|
||||
|
@ -92,6 +92,39 @@ public class SubserverSystem {
|
||||
MC_SCRIPT, "-b", owner.toString(), Integer.toString(port)).sendPlayer(p);
|
||||
}
|
||||
|
||||
public static void sendToBau15(ProxiedPlayer p, UUID owner){
|
||||
for(Subserver subserver : Subserver.getServerList()){
|
||||
if(subserver.getType() == Servertype.BAUSERVER && ((Bauserver)subserver).getOwner().equals(owner)){
|
||||
subserver.sendPlayer(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SteamwarUser user = SteamwarUser.get(owner);
|
||||
File w = new File(BungeeCore.USERWORLDS15 + user.getId());
|
||||
if (!w.exists() || !w.isDirectory()){
|
||||
try {
|
||||
Process pr;
|
||||
ProcessBuilder pb = new ProcessBuilder(
|
||||
"cp", "-r", BungeeCore.BAUWELT15, BungeeCore.USERWORLDS15 + user.getId());
|
||||
pr = pb.start();
|
||||
pr.waitFor();
|
||||
} catch (IOException e) {
|
||||
BungeeCore.log("Could not create Bauwelt", e);
|
||||
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDas Erstellen der Welt ist fehlgeschlagen.");
|
||||
return;
|
||||
} catch (InterruptedException e){
|
||||
BungeeCore.log("Could not create Bauwelt", e);
|
||||
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDas Erstellen der Welt ist fehlgeschlagen.");
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
int port = freePort(4000);
|
||||
|
||||
new Bauserver(user.getUserName() + "s Bau", owner, port,
|
||||
MC_SCRIPT, "-b", Integer.toString(user.getId()), Integer.toString(port)).sendPlayer(p);
|
||||
}
|
||||
|
||||
private static int freePort(int start){
|
||||
synchronized (Subserver.getServerList()){
|
||||
int port = start;
|
||||
|
@ -29,6 +29,9 @@ public class BauCommand {
|
||||
}
|
||||
|
||||
switch(command[1].toLowerCase()){
|
||||
case "15":
|
||||
SubserverSystem.sendToBau15(p, p.getUniqueId());
|
||||
break;
|
||||
case "addmember":
|
||||
addmember(p, command);
|
||||
break;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren