diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index d6f4df8..84d524d 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -29,6 +29,7 @@ import de.steamwar.messages.ChatSender; import de.steamwar.network.packets.server.BaumemberUpdatePacket; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -81,11 +82,16 @@ public class BauCommand extends BasicCommand { break; case "lock": - setLocked(SteamwarUser.get(p), args); + if(!(args.length < 2)) { + Message.send("BAU_LOCKED_OPTIONS", p); + return; + } + + setLocked(SteamwarUser.get(p), args[1]); break; case "unlock": - setLocked(SteamwarUser.get(p), new String[]{"", "open"}); + setLocked(SteamwarUser.get(p), "open"); break; default: @@ -127,7 +133,6 @@ public class BauCommand extends BasicCommand { return; } - SteamwarUser worldOwner = SteamwarUser.get(args[1]); SteamwarUser user = SteamwarUser.get(p); @@ -331,18 +336,21 @@ public class BauCommand extends BasicCommand { if(activeLockState == null) activeLockState = BauLockState.OPEN; + if(activeLockState == BauLockState.TEAM) + SubserverSystem.sendDeniedMessage(target.getPlayer(), owner.getUuid()); + return activeLockState == BauLockState.NOBODY || (activeLockState == BauLockState.TEAM && owner.getTeam() == target.getTeam()); } private static final String bauLockConfigName = "baulockstate"; - private static void setLocked(SteamwarUser owner, String[] args) { - if(args.length < 2 || BauLockState.valueOf(args[1]) == null) { + private static void setLocked(SteamwarUser owner, String arg) { + if(BauLockState.valueOf(arg) == null) { Message.send("BAU_LOCKED_OPTIONS", owner.getPlayer()); return; } - String lockState = args[1].toUpperCase(); + String lockState = arg.toUpperCase(); UserConfig.updateUserConfig(owner.getId(), bauLockConfigName, lockState); Message.send("BAU_LOCKED_" + lockState, owner.getPlayer());