Skip to content

Commit

Permalink
Version bump & Fix Scp Lockers
Browse files Browse the repository at this point in the history
  • Loading branch information
SebasCapo committed Dec 11, 2021
1 parent 04a298b commit 73edc99
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions RemoteKeycard/API/Extensions/PlayerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ public static class PlayerExtensions
/// </summary>
/// <param name="player"><see cref="Player"/> trying to interact.</param>
/// <param name="permissions">The permission that's gonna be searched for.</param>
/// <param name="requiresAllPermissions">Whether all permissions are required.</param>
/// <returns>Whether the player has the required keycard.</returns>
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<Amnesia>())
if (RemoteKeycard.Instance.Config.AmnesiaMatters && player.GetEffectActive<Amnesia>())
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);
}
}
}
4 changes: 2 additions & 2 deletions RemoteKeycard/EventsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace RemoteKeycard
/// </summary>
public class EventsHandler
{
private Config.Config config;
private readonly Config.Config config;

/// <summary>
/// Initializes a new instance of the <see cref="EventsHandler"/> class.
Expand Down Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions RemoteKeycard/RemoteKeycard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ public class RemoteKeycard : Plugin<Config.Config>
public override string Prefix => "remotekeycard";

/// <inheritdoc/>
public override Version RequiredExiledVersion => new Version(3, 0, 0);
public override Version RequiredExiledVersion => new Version(4, 1, 0);

/// <inheritdoc/>
public override string Author => "Beryl";

/// <inheritdoc/>
public override Version Version => new Version(3, 0, 0);
public override Version Version => new Version(3, 1, 0);

/// <inheritdoc cref="EventsHandler"/>
public EventsHandler Handler { get; private set; }
Expand Down
2 changes: 1 addition & 1 deletion RemoteKeycard/RemoteKeycard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EXILED" Version="3.0.0-alpha.83" />
<PackageReference Include="EXILED" Version="4.1.5" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 73edc99

Please sign in to comment.