diff --git a/RemoteKeycard/Config.cs b/RemoteKeycard/Config.cs
index 0d4fb00..4923c98 100644
--- a/RemoteKeycard/Config.cs
+++ b/RemoteKeycard/Config.cs
@@ -41,7 +41,13 @@ public class Config : IConfig
[Description("Toggle on/off exceptions/errors in console. (Enable this before reporting ANY bugs)")]
public bool ShowExceptions { get; set; } = false;
+ ///
+ /// Gets or sets a value indicating whether this plugin is enabled.
+ ///
public bool IsEnabled { get; set; } = true;
+ ///
+ /// Gets or sets a value indicating whether debug messages should be shown.
+ ///
public bool Debug { get; set; } = false;
}
\ No newline at end of file
diff --git a/RemoteKeycard/EventHandlers.cs b/RemoteKeycard/EventHandlers.cs
index d07ef72..144ffe8 100644
--- a/RemoteKeycard/EventHandlers.cs
+++ b/RemoteKeycard/EventHandlers.cs
@@ -8,7 +8,7 @@
public class EventHandlers
{
- private readonly Config config;
+ private readonly Config _config;
///
/// Initializes a new instance of the class.
@@ -16,7 +16,7 @@ public class EventHandlers
/// The settings that will be used.
public EventHandlers(Config config)
{
- this.config = config;
+ this._config = config;
}
///
@@ -47,7 +47,7 @@ private void OnDoorInteract(InteractingDoorEventArgs ev)
Log.Debug("Door Interact Event");
try
{
- if (!config.AffectDoors)
+ if (!_config.AffectDoors)
return;
Log.Debug(
@@ -59,7 +59,7 @@ private void OnDoorInteract(InteractingDoorEventArgs ev)
}
catch (Exception e)
{
- if (config.ShowExceptions)
+ if (_config.ShowExceptions)
Log.Warn($"{nameof(OnDoorInteract)}: {e.Message}\n{e.StackTrace}");
}
}
@@ -69,7 +69,7 @@ private void OnWarheadUnlock(ActivatingWarheadPanelEventArgs ev)
Log.Debug("Warhead Unlock Event");
try
{
- if (!config.AffectWarheadPanel)
+ if (!_config.AffectWarheadPanel)
return;
Log.Debug(
@@ -80,7 +80,7 @@ private void OnWarheadUnlock(ActivatingWarheadPanelEventArgs ev)
}
catch (Exception e)
{
- if (config.ShowExceptions)
+ if (_config.ShowExceptions)
Log.Warn($"{nameof(OnWarheadUnlock)}: {e.Message}\n{e.StackTrace}");
}
}
@@ -90,7 +90,7 @@ private void OnGeneratorUnlock(UnlockingGeneratorEventArgs ev)
Log.Debug("Generator Unlock Event");
try
{
- if (!config.AffectGenerators)
+ if (!_config.AffectGenerators)
return;
Log.Debug(
@@ -101,7 +101,7 @@ private void OnGeneratorUnlock(UnlockingGeneratorEventArgs ev)
}
catch (Exception e)
{
- if (config.ShowExceptions)
+ if (_config.ShowExceptions)
Log.Warn($"{nameof(OnGeneratorUnlock)}: {e.Message}\n{e.StackTrace}");
}
}
@@ -111,19 +111,19 @@ private void OnLockerInteract(InteractingLockerEventArgs ev)
Log.Debug("Locker Interact Event");
try
{
- if (!config.AffectScpLockers)
+ if (!_config.AffectScpLockers)
return;
Log.Debug(
- $"Allowed: {ev.IsAllowed}, Permission?: {ev.Player.HasKeycardPermission(ev.Chamber.RequiredPermissions, true)}");
+ $"Allowed: {ev.IsAllowed}, Permission?: {ev.Player.HasKeycardPermission(ev.InteractingChamber.Base.RequiredPermissions, true)}");
- if (!ev.IsAllowed && ev.Chamber != null &&
- ev.Player.HasKeycardPermission(ev.Chamber.RequiredPermissions, true))
+ if (!ev.IsAllowed && ev.InteractingChamber != null &&
+ ev.Player.HasKeycardPermission(ev.InteractingChamber.Base.RequiredPermissions, true))
ev.IsAllowed = true;
}
catch (Exception e)
{
- if (config.ShowExceptions)
+ if (_config.ShowExceptions)
Log.Warn($"{nameof(OnLockerInteract)}: {e.Message}\n{e.StackTrace}");
}
}
diff --git a/RemoteKeycard/Extensions.cs b/RemoteKeycard/Extensions.cs
index 4ff2a2e..ae7eef4 100644
--- a/RemoteKeycard/Extensions.cs
+++ b/RemoteKeycard/Extensions.cs
@@ -20,7 +20,7 @@ public static bool HasKeycardPermission(
KeycardPermissions permissions,
bool requiresAllPermissions = false)
{
- if (Plugin.Instance.Config.AmnesiaMatters && player.IsEffectActive())
+ if (Plugin.Instance != null && Plugin.Instance.Config.AmnesiaMatters && player.IsEffectActive())
return false;
return requiresAllPermissions
diff --git a/RemoteKeycard/Plugin.cs b/RemoteKeycard/Plugin.cs
index d3eb6bd..1fdd2d4 100644
--- a/RemoteKeycard/Plugin.cs
+++ b/RemoteKeycard/Plugin.cs
@@ -1,8 +1,8 @@
-namespace RemoteKeycard;
+#nullable enable
+namespace RemoteKeycard;
using System;
using Exiled.API.Features;
-using Players = Exiled.Events.Handlers.Player;
public class Plugin : Plugin
{
diff --git a/RemoteKeycard/RemoteKeycard.csproj b/RemoteKeycard/RemoteKeycard.csproj
index ab1cbb7..73ee670 100644
--- a/RemoteKeycard/RemoteKeycard.csproj
+++ b/RemoteKeycard/RemoteKeycard.csproj
@@ -17,10 +17,6 @@
none
-
-
-
-
@@ -29,4 +25,8 @@
+
+
+
+