SteamWar/BungeeCore
Archiviert
13
2

Merge branch '15testbaus' of SteamWar/BungeeCore into master

Dieser Commit ist enthalten in:
Lixfel 2019-12-31 12:45:58 +01:00 committet von Gitea
Commit 9e09ed089e
3 geänderte Dateien mit 40 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -39,6 +39,8 @@ public class BungeeCore extends Plugin {
public static String WORLD_FOLDER; public static String WORLD_FOLDER;
public static String BAUWELT_PROTOTYP; public static String BAUWELT_PROTOTYP;
public static String LOBBY_SERVER; public static String LOBBY_SERVER;
public static String USERWORLDS15;
public static String BAUWELT15;
private static BungeeCore instance; private static BungeeCore instance;
@ -182,6 +184,8 @@ public class BungeeCore extends Plugin {
WORLD_FOLDER = config.getString("worldfolder"); WORLD_FOLDER = config.getString("worldfolder");
BAUWELT_PROTOTYP = config.getString("bauweltprototyp"); BAUWELT_PROTOTYP = config.getString("bauweltprototyp");
LOBBY_SERVER = config.getString("lobbyserver"); LOBBY_SERVER = config.getString("lobbyserver");
USERWORLDS15 = config.getString("userworlds15");
BAUWELT15 = config.getString("bauwelt15");
Broadcaster.setBroadCastMsgs(config.getStringList("broadcasts").toArray(new String[1])); Broadcaster.setBroadCastMsgs(config.getStringList("broadcasts").toArray(new String[1]));
PollSystem.init(config.getString("poll.question"), config.getStringList("poll.answers")); PollSystem.init(config.getString("poll.question"), config.getStringList("poll.answers"));
Persistent.setChatPrefix(CHAT_PREFIX); Persistent.setChatPrefix(CHAT_PREFIX);

Datei anzeigen

@ -92,6 +92,39 @@ public class SubserverSystem {
MC_SCRIPT, "-b", owner.toString(), Integer.toString(port)).sendPlayer(p); 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, "-n", Integer.toString(user.getId()), Integer.toString(port)).sendPlayer(p);
}
private static int freePort(int start){ private static int freePort(int start){
synchronized (Subserver.getServerList()){ synchronized (Subserver.getServerList()){
int port = start; int port = start;

Datei anzeigen

@ -29,6 +29,9 @@ public class BauCommand {
} }
switch(command[1].toLowerCase()){ switch(command[1].toLowerCase()){
case "15":
SubserverSystem.sendToBau15(p, p.getUniqueId());
break;
case "addmember": case "addmember":
addmember(p, command); addmember(p, command);
break; break;