refactor: remove underscore prefix from private fields
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace CommandHook;
|
||||
|
||||
public class CommandHookModSystem : ModSystem
|
||||
{
|
||||
private readonly Dictionary<string, List<CommandRegistration>> _registrations = new();
|
||||
private readonly Dictionary<string, List<CommandRegistration>> 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<CommandRegistration>();
|
||||
_registrations[modId] = list;
|
||||
registrations[modId] = list;
|
||||
}
|
||||
list.Add(registration);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user