From 334afbac6391963c210a88a5757a4501f72cd151 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 21 Dec 2023 18:15:23 +0100 Subject: [PATCH] Add BauLockState.TEAM_AND_SERVERTEAM and BauLockState.SERVERTEAM as requested by many --- src/de/steamwar/bungeecore/util/BauLock.java | 8 ++++++++ src/de/steamwar/bungeecore/util/BauLockState.java | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/de/steamwar/bungeecore/util/BauLock.java b/src/de/steamwar/bungeecore/util/BauLock.java index 43926dd..238650d 100644 --- a/src/de/steamwar/bungeecore/util/BauLock.java +++ b/src/de/steamwar/bungeecore/util/BauLock.java @@ -22,6 +22,7 @@ package de.steamwar.bungeecore.util; import de.steamwar.bungeecore.Message; import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.UserConfig; +import de.steamwar.sql.UserPerm; import lombok.experimental.UtilityClass; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -43,6 +44,13 @@ public class BauLock { switch (state == null ? BauLockState.OPEN : BauLockState.valueOf(state)) { case NOBODY: return true; + case SERVERTEAM: + return !target.hasPerm(UserPerm.TEAM); + case TEAM_AND_SERVERTEAM: + if (target.hasPerm(UserPerm.TEAM)) { + return false; + } + return owner.getTeam() != target.getTeam(); case TEAM: return owner.getTeam() != target.getTeam(); case OPEN: diff --git a/src/de/steamwar/bungeecore/util/BauLockState.java b/src/de/steamwar/bungeecore/util/BauLockState.java index a5626b1..c3fa564 100644 --- a/src/de/steamwar/bungeecore/util/BauLockState.java +++ b/src/de/steamwar/bungeecore/util/BauLockState.java @@ -22,6 +22,8 @@ package de.steamwar.bungeecore.util; public enum BauLockState { NOBODY, // Locks the build server for all users + SERVERTEAM, // opens the build server only for every added user which is a server team member + TEAM_AND_SERVERTEAM, //opens the build server only for every added user which is in the same team as the buildOwner and every server team member TEAM, //opens the build server only for every added user which is in the same team as the buildOwner OPEN //unlocks the build server for all users }