diff --git a/RemoteKeycard/API/Extensions/PlayerExtensions.cs b/RemoteKeycard/API/Extensions/PlayerExtensions.cs index f1738ab..7a56b91 100644 --- a/RemoteKeycard/API/Extensions/PlayerExtensions.cs +++ b/RemoteKeycard/API/Extensions/PlayerExtensions.cs @@ -16,13 +16,16 @@ public static class PlayerExtensions /// /// trying to interact. /// The permission that's gonna be searched for. + /// Whether all permissions are required. /// Whether the player has the required keycard. - public static bool HasKeycardPermission(this Player player, KeycardPermissions permissions) + public static bool HasKeycardPermission(this Player player, KeycardPermissions permissions, bool requiresAllPermissions = false) { - if(RemoteKeycard.Instance.Config.AmnesiaMatters && player.GetEffectActive()) + if (RemoteKeycard.Instance.Config.AmnesiaMatters && player.GetEffectActive()) return false; - return player.Items.Any(item => item is Keycard keycard && (keycard.Base.Permissions & permissions) != 0); + return requiresAllPermissions ? + player.Items.Any(item => item is Keycard keycard && keycard.Base.Permissions.HasFlagFast(permissions)) + : player.Items.Any(item => item is Keycard keycard && (keycard.Base.Permissions & permissions) != 0); } } } diff --git a/RemoteKeycard/EventsHandler.cs b/RemoteKeycard/EventsHandler.cs index fe7b5b1..ea3c1ad 100644 --- a/RemoteKeycard/EventsHandler.cs +++ b/RemoteKeycard/EventsHandler.cs @@ -13,7 +13,7 @@ namespace RemoteKeycard /// public class EventsHandler { - private Config.Config config; + private readonly Config.Config config; /// /// Initializes a new instance of the class. @@ -132,7 +132,7 @@ private void OnLockerInteract(InteractingLockerEventArgs ev) if(!config.AffectScpLockers) return; - if(!ev.IsAllowed && ev.Chamber != null && ev.Player.HasKeycardPermission(ev.Chamber.RequiredPermissions)) + if(!ev.IsAllowed && ev.Chamber != null && ev.Player.HasKeycardPermission(ev.Chamber.RequiredPermissions, true)) { if(config.Extras.EnableEvents) { diff --git a/RemoteKeycard/RemoteKeycard.cs b/RemoteKeycard/RemoteKeycard.cs index 05623fe..690c781 100644 --- a/RemoteKeycard/RemoteKeycard.cs +++ b/RemoteKeycard/RemoteKeycard.cs @@ -21,13 +21,13 @@ public class RemoteKeycard : Plugin public override string Prefix => "remotekeycard"; /// - public override Version RequiredExiledVersion => new Version(3, 0, 0); + public override Version RequiredExiledVersion => new Version(4, 1, 0); /// public override string Author => "Beryl"; /// - public override Version Version => new Version(3, 0, 0); + public override Version Version => new Version(3, 1, 0); /// public EventsHandler Handler { get; private set; } diff --git a/RemoteKeycard/RemoteKeycard.csproj b/RemoteKeycard/RemoteKeycard.csproj index f7c54fe..193f04e 100644 --- a/RemoteKeycard/RemoteKeycard.csproj +++ b/RemoteKeycard/RemoteKeycard.csproj @@ -13,7 +13,7 @@ - +