SteamWar/BungeeCore
Archiviert
13
2

Make standard dependend on current client version

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2020-05-21 09:05:03 +02:00
Ursprung 4593705b97
Commit cee37c4389

Datei anzeigen

@ -24,15 +24,30 @@ public class BauCommand {
BungeeCore.log(p, e.getMessage()); BungeeCore.log(p, e.getMessage());
if(command.length == 1){ if(command.length == 1){
if(bau15(p, command, 1))
SubserverSystem.sendToBau15(p, p.getUniqueId()); SubserverSystem.sendToBau15(p, p.getUniqueId());
else
SubserverSystem.sendToBauServer(p, p.getUniqueId());
return; return;
} }
switch(command[1].toLowerCase()){ switch(command[1].toLowerCase()){
case "ws":
case "warship":
case "wg":
case "wargear":
case "12": case "12":
case "1.12": case "1.12":
SubserverSystem.sendToBauServer(p, p.getUniqueId()); SubserverSystem.sendToBauServer(p, p.getUniqueId());
break; break;
case "as":
case "airship":
case "mwg":
case "miniwargear":
case "15":
case "1.15":
SubserverSystem.sendToBau15(p, p.getUniqueId());
break;
case "addmember": case "addmember":
addmember(p, command); addmember(p, command);
break; break;
@ -113,10 +128,34 @@ public class BauCommand {
return; return;
} }
if(command.length > 3 && command[3].equals("1.12")) if(bau15(p, command, 3))
SubserverSystem.sendToBauServer(p, worldOwner.getUuid());
else
SubserverSystem.sendToBau15(p, worldOwner.getUuid()); SubserverSystem.sendToBau15(p, worldOwner.getUuid());
else
SubserverSystem.sendToBauServer(p, worldOwner.getUuid());
}
private static boolean bau15(ProxiedPlayer p, String[] args, int pos){
if(args.length <= pos)
return p.getPendingConnection().getVersion() > 340; // Version > 1.12.2
switch(args[pos].toLowerCase()){
case "ws":
case "warship":
case "wg":
case "wargear":
case "12":
case "1.12":
return false;
case "as":
case "airship":
case "mwg":
case "miniwargear":
case "15":
case "1.15":
return true;
default:
return p.getPendingConnection().getVersion() > 340; // Version > 1.12.2
}
} }
private static void togglebuild(ProxiedPlayer p, String[] command){ private static void togglebuild(ProxiedPlayer p, String[] command){
@ -168,12 +207,7 @@ public class BauCommand {
} }
private static void delete(ProxiedPlayer p, String[] command){ private static void delete(ProxiedPlayer p, String[] command){
if(command.length > 2){ if(bau15(p, command, 2)){
if(!command[2].equals("1.12")){
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§c Unbekannte Option: " + command[2]);
return;
}
BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDeine Welt wird zurückgesetzt."); BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDeine Welt wird zurückgesetzt.");
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
for (Subserver subserver : Subserver.getServerList()) { for (Subserver subserver : Subserver.getServerList()) {
@ -182,7 +216,8 @@ public class BauCommand {
break; break;
} }
} }
File directory = new File(BungeeCore.WORLD_FOLDER + p.getUniqueId().toString()); SteamwarUser user = SteamwarUser.get(p.getUniqueId());
File directory = new File(BungeeCore.USERWORLDS15 + user.getId());
del(directory); del(directory);
}); });
}else{ }else{
@ -194,8 +229,7 @@ public class BauCommand {
break; break;
} }
} }
SteamwarUser user = SteamwarUser.get(p.getUniqueId()); File directory = new File(BungeeCore.WORLD_FOLDER + p.getUniqueId().toString());
File directory = new File(BungeeCore.USERWORLDS15 + user.getId());
del(directory); del(directory);
}); });
} }