From 4593705b979be8f7b6e9e9aae5cef1e2a33d7081 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 26 Apr 2020 09:06:41 +0200 Subject: [PATCH 1/2] Changing standard bau to 1.15 Signed-off-by: Lixfel --- .../bungeecore/commands/BauCommand.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 3dd26286..90cba425 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -24,14 +24,14 @@ public class BauCommand { BungeeCore.log(p, e.getMessage()); if(command.length == 1){ - SubserverSystem.sendToBauServer(p, p.getUniqueId()); + SubserverSystem.sendToBau15(p, p.getUniqueId()); return; } switch(command[1].toLowerCase()){ - case "15": - case "1.15": - SubserverSystem.sendToBau15(p, p.getUniqueId()); + case "12": + case "1.12": + SubserverSystem.sendToBauServer(p, p.getUniqueId()); break; case "addmember": addmember(p, command); @@ -113,10 +113,10 @@ public class BauCommand { return; } - if(command.length > 3 && command[3].equals("1.15")) - SubserverSystem.sendToBau15(p, worldOwner.getUuid()); - else + if(command.length > 3 && command[3].equals("1.12")) SubserverSystem.sendToBauServer(p, worldOwner.getUuid()); + else + SubserverSystem.sendToBau15(p, worldOwner.getUuid()); } private static void togglebuild(ProxiedPlayer p, String[] command){ @@ -169,7 +169,7 @@ public class BauCommand { private static void delete(ProxiedPlayer p, String[] command){ if(command.length > 2){ - if(!command[2].equals("1.15")){ + if(!command[2].equals("1.12")){ BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§c Unbekannte Option: " + command[2]); return; } @@ -182,8 +182,7 @@ public class BauCommand { break; } } - SteamwarUser user = SteamwarUser.get(p.getUniqueId()); - File directory = new File(BungeeCore.USERWORLDS15 + user.getId()); + File directory = new File(BungeeCore.WORLD_FOLDER + p.getUniqueId().toString()); del(directory); }); }else{ @@ -195,7 +194,8 @@ public class BauCommand { 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); }); } From cee37c438991f3d6af763749d058ea796e604224 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 21 May 2020 09:05:03 +0200 Subject: [PATCH 2/2] Make standard dependend on current client version Signed-off-by: Lixfel --- .../bungeecore/commands/BauCommand.java | 60 +++++++++++++++---- 1 file changed, 47 insertions(+), 13 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 90cba425..bb744060 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -24,15 +24,30 @@ public class BauCommand { BungeeCore.log(p, e.getMessage()); if(command.length == 1){ - SubserverSystem.sendToBau15(p, p.getUniqueId()); + if(bau15(p, command, 1)) + SubserverSystem.sendToBau15(p, p.getUniqueId()); + else + SubserverSystem.sendToBauServer(p, p.getUniqueId()); return; } switch(command[1].toLowerCase()){ + case "ws": + case "warship": + case "wg": + case "wargear": case "12": case "1.12": SubserverSystem.sendToBauServer(p, p.getUniqueId()); break; + case "as": + case "airship": + case "mwg": + case "miniwargear": + case "15": + case "1.15": + SubserverSystem.sendToBau15(p, p.getUniqueId()); + break; case "addmember": addmember(p, command); break; @@ -113,10 +128,34 @@ public class BauCommand { return; } - if(command.length > 3 && command[3].equals("1.12")) - SubserverSystem.sendToBauServer(p, worldOwner.getUuid()); - else + if(bau15(p, command, 3)) 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){ @@ -168,12 +207,7 @@ public class BauCommand { } private static void delete(ProxiedPlayer p, String[] command){ - if(command.length > 2){ - if(!command[2].equals("1.12")){ - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§c Unbekannte Option: " + command[2]); - return; - } - + if(bau15(p, command, 2)){ BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDeine Welt wird zurückgesetzt."); ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { for (Subserver subserver : Subserver.getServerList()) { @@ -182,7 +216,8 @@ public class BauCommand { 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); }); }else{ @@ -194,8 +229,7 @@ public class BauCommand { break; } } - SteamwarUser user = SteamwarUser.get(p.getUniqueId()); - File directory = new File(BungeeCore.USERWORLDS15 + user.getId()); + File directory = new File(BungeeCore.WORLD_FOLDER + p.getUniqueId().toString()); del(directory); }); }