SteamWar/BungeeCore
Archiviert
13
2

+Add Owner message when bau is locked for Team
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
MoBrot 2022-09-08 20:49:17 +02:00
Ursprung ef6435b176
Commit fe0d0eaffb

Datei anzeigen

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