From 4cbfdb8be3ffd37dffd3b4e36cfd2db03fe610ce Mon Sep 17 00:00:00 2001 From: anth64 Date: Tue, 2 Jun 2026 23:28:40 +0200 Subject: [PATCH] refactor: remove underscore prefix from private fields --- CommandHook/CommandData.cs | 10 +++++----- CommandHook/CommandHookModSystem.cs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CommandHook/CommandData.cs b/CommandHook/CommandData.cs index 03bc5ec..348f4ee 100644 --- a/CommandHook/CommandData.cs +++ b/CommandHook/CommandData.cs @@ -7,16 +7,16 @@ public struct CommandData public readonly IServerPlayer? Sender; public readonly string FullCommand; public readonly string CommandName; - private byte _flags; + private byte flags; private const byte FlagIsPlayerCommand = 1 << 0; private const byte FlagCancel = 1 << 1; - public bool IsPlayerCommand => (_flags & FlagIsPlayerCommand) != 0; + public bool IsPlayerCommand => (flags & FlagIsPlayerCommand) != 0; public bool Cancel { - get => (_flags & FlagCancel) != 0; - set => _flags = value ? (byte)(_flags | FlagCancel) : (byte)(_flags & ~FlagCancel); + get => (flags & FlagCancel) != 0; + set => flags = value ? (byte)(flags | FlagCancel) : (byte)(flags & ~FlagCancel); } public CommandData(IServerPlayer? sender, string fullCommand) @@ -24,6 +24,6 @@ public struct CommandData Sender = sender; FullCommand = fullCommand.Length > 0 ? fullCommand.Trim() : string.Empty; CommandName = FullCommand.Length > 1 ? FullCommand[1..].Split(' ')[0] : string.Empty; - _flags = sender != null ? FlagIsPlayerCommand : (byte)0; + flags = sender != null ? FlagIsPlayerCommand : (byte)0; } } diff --git a/CommandHook/CommandHookModSystem.cs b/CommandHook/CommandHookModSystem.cs index c153a8e..949a40e 100644 --- a/CommandHook/CommandHookModSystem.cs +++ b/CommandHook/CommandHookModSystem.cs @@ -6,7 +6,7 @@ namespace CommandHook; public class CommandHookModSystem : ModSystem { - private readonly Dictionary> _registrations = new(); + private readonly Dictionary> registrations = new(); public override bool ShouldLoad(EnumAppSide forSide) => forSide == EnumAppSide.Server; @@ -17,10 +17,10 @@ public class CommandHookModSystem : ModSystem public void Register(string modId, CommandRegistration registration) { - if (!_registrations.TryGetValue(modId, out var list)) + if (!registrations.TryGetValue(modId, out var list)) { list = new List(); - _registrations[modId] = list; + registrations[modId] = list; } list.Add(registration); }