Random spontaneous cleanup PR (#25131)
* Use new Subs.CVar helper Removes manual config OnValueChanged calls, removes need to remember to manually unsubscribe. This both reduces boilerplate and fixes many issues where subscriptions weren't removed on entity system shutdown. * Fix a bunch of warnings * More warning fixes * Use new DateTime serializer to get rid of ISerializationHooks in changelog code. * Get rid of some more ISerializationHooks for enums * And a little more * Apply suggestions from code review Co-authored-by: 0x6273 <0x40@keemail.me> --------- Co-authored-by: 0x6273 <0x40@keemail.me>
This commit is contained in:
committed by
GitHub
parent
d0c174388c
commit
68ce53ae17
@@ -15,11 +15,13 @@ namespace Content.Client.Administration.Managers
|
||||
[Dependency] private readonly IClientNetManager _netMgr = default!;
|
||||
[Dependency] private readonly IClientConGroupController _conGroup = default!;
|
||||
[Dependency] private readonly IResourceManager _res = default!;
|
||||
[Dependency] private readonly ILogManager _logManager = default!;
|
||||
|
||||
private AdminData? _adminData;
|
||||
private readonly HashSet<string> _availableCommands = new();
|
||||
|
||||
private readonly AdminCommandPermissions _localCommandPermissions = new();
|
||||
private ISawmill _sawmill = default!;
|
||||
|
||||
public event Action? AdminStatusUpdated;
|
||||
|
||||
@@ -92,17 +94,17 @@ namespace Content.Client.Administration.Managers
|
||||
}
|
||||
|
||||
_availableCommands.UnionWith(message.AvailableCommands);
|
||||
Logger.DebugS("admin", $"Have {message.AvailableCommands.Length} commands available");
|
||||
_sawmill.Debug($"Have {message.AvailableCommands.Length} commands available");
|
||||
|
||||
_adminData = message.Admin;
|
||||
if (_adminData != null)
|
||||
{
|
||||
var flagsText = string.Join("|", AdminFlagsHelper.FlagsToNames(_adminData.Flags));
|
||||
Logger.InfoS("admin", $"Updated admin status: {_adminData.Active}/{_adminData.Title}/{flagsText}");
|
||||
_sawmill.Info($"Updated admin status: {_adminData.Active}/{_adminData.Title}/{flagsText}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.InfoS("admin", "Updated admin status: Not admin");
|
||||
_sawmill.Info("Updated admin status: Not admin");
|
||||
}
|
||||
|
||||
AdminStatusUpdated?.Invoke();
|
||||
@@ -114,18 +116,17 @@ namespace Content.Client.Administration.Managers
|
||||
void IPostInjectInit.PostInject()
|
||||
{
|
||||
_conGroup.Implementation = this;
|
||||
_sawmill = _logManager.GetSawmill("admin");
|
||||
}
|
||||
|
||||
public AdminData? GetAdminData(EntityUid uid, bool includeDeAdmin = false)
|
||||
{
|
||||
return uid == _player.LocalPlayer?.ControlledEntity
|
||||
? _adminData
|
||||
: null;
|
||||
return uid == _player.LocalEntity ? _adminData : null;
|
||||
}
|
||||
|
||||
public AdminData? GetAdminData(ICommonSession session, bool includeDeAdmin = false)
|
||||
{
|
||||
if (_player.LocalPlayer?.UserId == session.UserId)
|
||||
if (_player.LocalUser == session.UserId)
|
||||
return _adminData;
|
||||
|
||||
return null;
|
||||
@@ -133,7 +134,7 @@ namespace Content.Client.Administration.Managers
|
||||
|
||||
public AdminData? GetAdminData(bool includeDeAdmin = false)
|
||||
{
|
||||
if (_player.LocalPlayer is { Session: { } session })
|
||||
if (_player.LocalSession is { } session)
|
||||
return GetAdminData(session, includeDeAdmin);
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user