IPlayerManager refactor (#21215)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Administration
|
||||
{
|
||||
@@ -8,7 +8,7 @@ namespace Content.Server.Administration
|
||||
/// </summary>
|
||||
public sealed class AdminPermsChangedEventArgs : EventArgs
|
||||
{
|
||||
public AdminPermsChangedEventArgs(IPlayerSession player, AdminFlags? flags)
|
||||
public AdminPermsChangedEventArgs(ICommonSession player, AdminFlags? flags)
|
||||
{
|
||||
Player = player;
|
||||
Flags = flags;
|
||||
@@ -17,7 +17,7 @@ namespace Content.Server.Administration
|
||||
/// <summary>
|
||||
/// The player that had their admin permissions changed.
|
||||
/// </summary>
|
||||
public IPlayerSession Player { get; }
|
||||
public ICommonSession Player { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The admin flags of the player. Null if the player is no longer an admin.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
@@ -18,7 +17,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteLine("Nah");
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.Afk;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -35,7 +34,7 @@ public sealed class AdminWhoCommand : IConsoleCommand
|
||||
if (adminData.Title is { } title)
|
||||
sb.Append($": [{title}]");
|
||||
|
||||
if (shell.Player is IPlayerSession player && adminMgr.HasAdminFlag(player, AdminFlags.Admin))
|
||||
if (shell.Player is { } player && adminMgr.HasAdminFlag(player, AdminFlags.Admin))
|
||||
{
|
||||
if (afk.IsAfk(admin))
|
||||
sb.Append(" [AFK]");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Server.Administration.UI;
|
||||
using Content.Server.EUI;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
@@ -17,7 +16,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteLine("This does not work from the server console.");
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.Administration.Notes;
|
||||
using Content.Server.Database;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Players.PlayTimeTracking;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Console;
|
||||
@@ -84,7 +77,7 @@ public sealed class BanCommand : LocalizedCommands
|
||||
}
|
||||
|
||||
var located = await _locator.LookupIdByNameOrIdAsync(target);
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var player = shell.Player;
|
||||
|
||||
if (located == null)
|
||||
{
|
||||
@@ -102,7 +95,7 @@ public sealed class BanCommand : LocalizedCommands
|
||||
{
|
||||
if (args.Length == 1)
|
||||
{
|
||||
var options = _playerManager.ServerSessions.Select(c => c.Name).OrderBy(c => c).ToArray();
|
||||
var options = _playerManager.Sessions.Select(c => c.Name).OrderBy(c => c).ToArray();
|
||||
return CompletionResult.FromHintOptions(options, LocalizationManager.GetString("cmd-ban-hint"));
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public sealed class BanListCommand : LocalizedCommands
|
||||
return;
|
||||
}
|
||||
|
||||
if (shell.Player is not IPlayerSession player)
|
||||
if (shell.Player is not { } player)
|
||||
{
|
||||
var bans = await _dbManager.GetServerBansAsync(data.LastAddress, data.UserId, data.LastHWId, false);
|
||||
|
||||
@@ -67,7 +67,7 @@ public sealed class BanListCommand : LocalizedCommands
|
||||
return CompletionResult.Empty;
|
||||
|
||||
var playerMgr = IoCManager.Resolve<IPlayerManager>();
|
||||
var options = playerMgr.ServerSessions.Select(c => c.Name).OrderBy(c => c).ToArray();
|
||||
var options = playerMgr.Sessions.Select(c => c.Name).OrderBy(c => c).ToArray();
|
||||
return CompletionResult.FromHintOptions(options, Loc.GetString("cmd-banlist-hint"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.EUI;
|
||||
using Robust.Server.Player;
|
||||
|
||||
namespace Content.Server.Administration.Commands;
|
||||
|
||||
@@ -21,7 +15,7 @@ public sealed class BanPanelCommand : LocalizedCommands
|
||||
|
||||
public override async void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (shell.Player is not IPlayerSession player)
|
||||
if (shell.Player is not { } player)
|
||||
{
|
||||
shell.WriteError(Loc.GetString("cmd-banpanel-server"));
|
||||
return;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
@@ -16,7 +15,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (shell.Player is not IPlayerSession player)
|
||||
if (shell.Player is not { } player)
|
||||
{
|
||||
shell.WriteLine("shell-server-cannot");
|
||||
return;
|
||||
@@ -42,14 +41,7 @@ namespace Content.Server.Administration.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
var mindSystem = _entities.System<SharedMindSystem>();
|
||||
if (!mindSystem.TryGetMind(target, out var mindId, out var mind))
|
||||
{
|
||||
shell.WriteLine(Loc.GetString("shell-entity-is-not-mob"));
|
||||
return;
|
||||
}
|
||||
|
||||
mindSystem.TransferTo(mindId, target, mind: mind);
|
||||
_entities.System<MindSystem>().ControlMob(player.UserId, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using Content.Server.Chat;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
@@ -17,7 +15,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteLine("shell-only-players-can-run-this-command");
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[UsedImplicitly]
|
||||
@@ -17,7 +15,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteLine("You cannot use this command from the server console.");
|
||||
|
||||
@@ -3,7 +3,6 @@ using Content.Server.EUI;
|
||||
using Content.Server.Explosion.EntitySystems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Explosion;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -21,7 +20,7 @@ public sealed class OpenExplosionEui : IConsoleCommand
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteError("This does not work from the server console.");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Fax.AdminUI;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Administration.Commands;
|
||||
@@ -16,7 +15,7 @@ public sealed class FaxUiCommand : IConsoleCommand
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteLine("shell-only-players-can-run-this-command");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.EUI;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Administration.Commands;
|
||||
@@ -15,7 +14,7 @@ public sealed class OpenAdminLogsCommand : IConsoleCommand
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (shell.Player is not IPlayerSession player)
|
||||
if (shell.Player is not { } player)
|
||||
{
|
||||
shell.WriteLine("This does not work from the server console.");
|
||||
return;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using Content.Server.Administration.Notes;
|
||||
using Content.Server.Database;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Administration.Commands;
|
||||
@@ -17,7 +15,7 @@ public sealed class OpenAdminNotesCommand : IConsoleCommand
|
||||
|
||||
public async void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (shell.Player is not IPlayerSession player)
|
||||
if (shell.Player is not { } player)
|
||||
{
|
||||
shell.WriteError("This does not work from the server console.");
|
||||
return;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using Content.Server.Administration.UI;
|
||||
using Content.Server.EUI;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AdminCommand(AdminFlags.Permissions)]
|
||||
@@ -16,7 +14,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteLine("This does not work from the server console.");
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Content.Server.Administration.Notes;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.CCVar;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
@@ -27,7 +26,7 @@ public sealed class OpenUserVisibleNotesCommand : IConsoleCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if (shell.Player is not IPlayerSession player)
|
||||
if (shell.Player is not { } player)
|
||||
{
|
||||
shell.WriteError("This does not work from the server console.");
|
||||
return;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Text;
|
||||
using Content.Server.Database;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
@@ -15,7 +14,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public async void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var player = shell.Player;
|
||||
var dbMan = IoCManager.Resolve<IServerDbManager>();
|
||||
|
||||
if (args.Length != 1)
|
||||
|
||||
@@ -6,7 +6,6 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.ContentPack;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Administration.Commands;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
{
|
||||
[AnyCommand]
|
||||
@@ -15,7 +13,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteLine("You cannot use this command from the server console.");
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
|
||||
using Content.Server.Database;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Administration.Commands
|
||||
@@ -16,7 +14,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (!(shell.Player is IPlayerSession))
|
||||
if (shell.Player == null)
|
||||
{
|
||||
shell.WriteError(Loc.GetString("shell-only-players-can-run-this-command"));
|
||||
return;
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Players;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ using Content.Shared.PDA;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
@@ -57,7 +56,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
if (args.Length == 1)
|
||||
{
|
||||
if (shell.Player is not IPlayerSession player)
|
||||
if (shell.Player is not { } player)
|
||||
{
|
||||
shell.WriteError(Loc.GetString("set-outfit-command-is-not-player-error"));
|
||||
return;
|
||||
|
||||
@@ -4,11 +4,9 @@ using Content.Server.Warps;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.Ghost;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
|
||||
@@ -28,7 +26,7 @@ namespace Content.Server.Administration.Commands
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var player = shell.Player as IPlayerSession;
|
||||
var player = shell.Player;
|
||||
if (player == null)
|
||||
{
|
||||
shell.WriteLine("Only players can use this command");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Content.Server.Database;
|
||||
using Content.Shared.CCVar;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Server.Upload;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Upload;
|
||||
|
||||
namespace Content.Server.Administration;
|
||||
@@ -22,7 +22,7 @@ public sealed class ContentNetworkResourceManager
|
||||
_netRes.OnResourceUploaded += OnUploadResource;
|
||||
}
|
||||
|
||||
private async void OnUploadResource(IPlayerSession session, NetworkResourceUploadMessage msg)
|
||||
private async void OnUploadResource(ICommonSession session, NetworkResourceUploadMessage msg)
|
||||
{
|
||||
if (StoreUploaded)
|
||||
await _serverDb.AddUploadedResourceLogAsync(session.UserId, DateTime.Now, msg.RelativePath.ToString(), msg.Data);
|
||||
|
||||
@@ -3,8 +3,8 @@ using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Content.Server.Administration.Logs.Converters;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Administration.Logs;
|
||||
|
||||
@@ -44,7 +44,7 @@ public sealed partial class AdminLogManager
|
||||
var value = properties[key];
|
||||
value = value switch
|
||||
{
|
||||
IPlayerSession player => new SerializablePlayer(player),
|
||||
ICommonSession player => new SerializablePlayer(player),
|
||||
EntityCoordinates entityCoordinates => new SerializableEntityCoordinates(_entityManager, entityCoordinates),
|
||||
_ => value
|
||||
};
|
||||
@@ -56,7 +56,7 @@ public sealed partial class AdminLogManager
|
||||
{
|
||||
EntityUid id => id,
|
||||
EntityStringRepresentation rep => rep.Uid,
|
||||
IPlayerSession {AttachedEntity: {Valid: true}} session => session.AttachedEntity,
|
||||
ICommonSession {AttachedEntity: {Valid: true}} session => session.AttachedEntity,
|
||||
IComponent component => component.Owner,
|
||||
_ => null
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Text.Json;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Administration.Logs.Converters;
|
||||
|
||||
@@ -36,9 +36,9 @@ public sealed class PlayerSessionConverter : AdminLogConverter<SerializablePlaye
|
||||
|
||||
public readonly struct SerializablePlayer
|
||||
{
|
||||
public readonly IPlayerSession Player;
|
||||
public readonly ICommonSession Player;
|
||||
|
||||
public SerializablePlayer(IPlayerSession player)
|
||||
public SerializablePlayer(ICommonSession player)
|
||||
{
|
||||
Player = player;
|
||||
}
|
||||
|
||||
@@ -7,15 +7,15 @@ using Content.Server.Database;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Players;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.ContentPack;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Toolshed;
|
||||
using Robust.Shared.Toolshed.Errors;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -35,16 +35,16 @@ namespace Content.Server.Administration.Managers
|
||||
[Dependency] private readonly IChatManager _chat = default!;
|
||||
[Dependency] private readonly ToolshedManager _toolshed = default!;
|
||||
|
||||
private readonly Dictionary<IPlayerSession, AdminReg> _admins = new();
|
||||
private readonly Dictionary<ICommonSession, AdminReg> _admins = new();
|
||||
private readonly HashSet<NetUserId> _promotedPlayers = new();
|
||||
|
||||
public event Action<AdminPermsChangedEventArgs>? OnPermsChanged;
|
||||
|
||||
public IEnumerable<IPlayerSession> ActiveAdmins => _admins
|
||||
public IEnumerable<ICommonSession> ActiveAdmins => _admins
|
||||
.Where(p => p.Value.Data.Active)
|
||||
.Select(p => p.Key);
|
||||
|
||||
public IEnumerable<IPlayerSession> AllAdmins => _admins.Select(p => p.Key);
|
||||
public IEnumerable<ICommonSession> AllAdmins => _admins.Select(p => p.Key);
|
||||
|
||||
private readonly AdminCommandPermissions _commandPermissions = new();
|
||||
private readonly AdminCommandPermissions _toolshedCommandPermissions = new();
|
||||
@@ -56,7 +56,7 @@ namespace Content.Server.Administration.Managers
|
||||
|
||||
public AdminData? GetAdminData(ICommonSession session, bool includeDeAdmin = false)
|
||||
{
|
||||
if (_admins.TryGetValue((IPlayerSession)session, out var reg) && (reg.Data.Active || includeDeAdmin))
|
||||
if (_admins.TryGetValue(session, out var reg) && (reg.Data.Active || includeDeAdmin))
|
||||
{
|
||||
return reg.Data;
|
||||
}
|
||||
@@ -66,13 +66,13 @@ namespace Content.Server.Administration.Managers
|
||||
|
||||
public AdminData? GetAdminData(EntityUid uid, bool includeDeAdmin = false)
|
||||
{
|
||||
if (_playerManager.TryGetSessionByEntity(uid, out var session) && session is IPlayerSession playerSession)
|
||||
return GetAdminData(playerSession, includeDeAdmin);
|
||||
if (_playerManager.TryGetSessionByEntity(uid, out var session))
|
||||
return GetAdminData(session, includeDeAdmin);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void DeAdmin(IPlayerSession session)
|
||||
public void DeAdmin(ICommonSession session)
|
||||
{
|
||||
if (!_admins.TryGetValue(session, out var reg))
|
||||
{
|
||||
@@ -95,7 +95,7 @@ namespace Content.Server.Administration.Managers
|
||||
UpdateAdminStatus(session);
|
||||
}
|
||||
|
||||
public void ReAdmin(IPlayerSession session)
|
||||
public void ReAdmin(ICommonSession session)
|
||||
{
|
||||
if (!_admins.TryGetValue(session, out var reg))
|
||||
{
|
||||
@@ -119,7 +119,7 @@ namespace Content.Server.Administration.Managers
|
||||
UpdateAdminStatus(session);
|
||||
}
|
||||
|
||||
public async void ReloadAdmin(IPlayerSession player)
|
||||
public async void ReloadAdmin(ICommonSession player)
|
||||
{
|
||||
var data = await LoadAdminData(player);
|
||||
var curAdmin = _admins.GetValueOrDefault(player);
|
||||
@@ -236,7 +236,7 @@ namespace Content.Server.Administration.Managers
|
||||
_toolshed.ActivePermissionController = this;
|
||||
}
|
||||
|
||||
public void PromoteHost(IPlayerSession player)
|
||||
public void PromoteHost(ICommonSession player)
|
||||
{
|
||||
_promotedPlayers.Add(player.UserId);
|
||||
|
||||
@@ -250,7 +250,7 @@ namespace Content.Server.Administration.Managers
|
||||
}
|
||||
|
||||
// NOTE: Also sends commands list for non admins..
|
||||
private void UpdateAdminStatus(IPlayerSession session)
|
||||
private void UpdateAdminStatus(ICommonSession session)
|
||||
{
|
||||
var msg = new MsgUpdateAdminStatus();
|
||||
|
||||
@@ -290,7 +290,7 @@ namespace Content.Server.Administration.Managers
|
||||
}
|
||||
}
|
||||
|
||||
private async void LoginAdminMaybe(IPlayerSession session)
|
||||
private async void LoginAdminMaybe(ICommonSession session)
|
||||
{
|
||||
var adminDat = await LoadAdminData(session);
|
||||
if (adminDat == null)
|
||||
@@ -323,7 +323,7 @@ namespace Content.Server.Administration.Managers
|
||||
UpdateAdminStatus(session);
|
||||
}
|
||||
|
||||
private async Task<(AdminData dat, int? rankId, bool specialLogin)?> LoadAdminData(IPlayerSession session)
|
||||
private async Task<(AdminData dat, int? rankId, bool specialLogin)?> LoadAdminData(ICommonSession session)
|
||||
{
|
||||
var promoteHost = IsLocal(session) && _cfg.GetCVar(CCVars.ConsoleLoginLocal)
|
||||
|| _promotedPlayers.Contains(session.UserId)
|
||||
@@ -387,7 +387,7 @@ namespace Content.Server.Administration.Managers
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsLocal(IPlayerSession player)
|
||||
private static bool IsLocal(ICommonSession player)
|
||||
{
|
||||
var ep = player.ConnectedClient.RemoteEndPoint;
|
||||
var addr = ep.Address;
|
||||
@@ -419,7 +419,7 @@ namespace Content.Server.Administration.Managers
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CanCommand(IPlayerSession session, string cmdName)
|
||||
public bool CanCommand(ICommonSession session, string cmdName)
|
||||
{
|
||||
if (_commandPermissions.AnyCommands.Contains(cmdName))
|
||||
{
|
||||
@@ -474,7 +474,7 @@ namespace Content.Server.Administration.Managers
|
||||
return true;
|
||||
}
|
||||
|
||||
var data = GetAdminData((IPlayerSession)user);
|
||||
var data = GetAdminData(user);
|
||||
if (data == null)
|
||||
{
|
||||
// Player isn't an admin.
|
||||
@@ -520,32 +520,32 @@ namespace Content.Server.Administration.Managers
|
||||
return (attribs.Length != 0, attribs);
|
||||
}
|
||||
|
||||
public bool CanViewVar(IPlayerSession session)
|
||||
public bool CanViewVar(ICommonSession session)
|
||||
{
|
||||
return CanCommand(session, "vv");
|
||||
}
|
||||
|
||||
public bool CanAdminPlace(IPlayerSession session)
|
||||
public bool CanAdminPlace(ICommonSession session)
|
||||
{
|
||||
return GetAdminData(session)?.CanAdminPlace() ?? false;
|
||||
}
|
||||
|
||||
public bool CanScript(IPlayerSession session)
|
||||
public bool CanScript(ICommonSession session)
|
||||
{
|
||||
return GetAdminData(session)?.CanScript() ?? false;
|
||||
}
|
||||
|
||||
public bool CanAdminMenu(IPlayerSession session)
|
||||
public bool CanAdminMenu(ICommonSession session)
|
||||
{
|
||||
return GetAdminData(session)?.CanAdminMenu() ?? false;
|
||||
}
|
||||
|
||||
public bool CanAdminReloadPrototypes(IPlayerSession session)
|
||||
public bool CanAdminReloadPrototypes(ICommonSession session)
|
||||
{
|
||||
return GetAdminData(session)?.CanAdminReloadPrototypes() ?? false;
|
||||
}
|
||||
|
||||
private void SendPermsChangedEvent(IPlayerSession session)
|
||||
private void SendPermsChangedEvent(ICommonSession session)
|
||||
{
|
||||
var flags = GetAdminData(session)?.Flags;
|
||||
OnPermsChanged?.Invoke(new AdminPermsChangedEventArgs(session, flags));
|
||||
@@ -553,7 +553,7 @@ namespace Content.Server.Administration.Managers
|
||||
|
||||
private sealed class AdminReg
|
||||
{
|
||||
public readonly IPlayerSession Session;
|
||||
public readonly ICommonSession Session;
|
||||
|
||||
public AdminData Data;
|
||||
public int? RankId;
|
||||
@@ -561,7 +561,7 @@ namespace Content.Server.Administration.Managers
|
||||
// Such as console.loginlocal or promotehost
|
||||
public bool IsSpecialLogin;
|
||||
|
||||
public AdminReg(IPlayerSession session, AdminData data)
|
||||
public AdminReg(ICommonSession session, AdminData data)
|
||||
{
|
||||
Data = data;
|
||||
Session = session;
|
||||
|
||||
@@ -15,6 +15,7 @@ using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -283,7 +284,7 @@ public sealed class BanManager : IBanManager, IPostInjectInit
|
||||
SendRoleBans(player);
|
||||
}
|
||||
|
||||
public void SendRoleBans(IPlayerSession pSession)
|
||||
public void SendRoleBans(ICommonSession pSession)
|
||||
{
|
||||
var roleBans = _cachedRoleBans.GetValueOrDefault(pSession.UserId) ?? new HashSet<ServerRoleBanDef>();
|
||||
var bans = new MsgRoleBans()
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Administration.Managers;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Toolshed;
|
||||
|
||||
|
||||
namespace Content.Server.Administration.Managers
|
||||
{
|
||||
/// <summary>
|
||||
@@ -22,12 +21,12 @@ namespace Content.Server.Administration.Managers
|
||||
/// <remarks>
|
||||
/// This does not include admins that are de-adminned.
|
||||
/// </remarks>
|
||||
IEnumerable<IPlayerSession> ActiveAdmins { get; }
|
||||
IEnumerable<ICommonSession> ActiveAdmins { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets all admins currently on the server, even de-adminned ones.
|
||||
/// </summary>
|
||||
IEnumerable<IPlayerSession> AllAdmins { get; }
|
||||
IEnumerable<ICommonSession> AllAdmins { get; }
|
||||
|
||||
/// <summary>
|
||||
/// De-admins an admin temporarily so they are effectively a normal player.
|
||||
@@ -35,18 +34,18 @@ namespace Content.Server.Administration.Managers
|
||||
/// <remarks>
|
||||
/// De-adminned admins are able to re-admin at any time if they so desire.
|
||||
/// </remarks>
|
||||
void DeAdmin(IPlayerSession session);
|
||||
void DeAdmin(ICommonSession session);
|
||||
|
||||
/// <summary>
|
||||
/// Re-admins a de-adminned admin.
|
||||
/// </summary>
|
||||
void ReAdmin(IPlayerSession session);
|
||||
void ReAdmin(ICommonSession session);
|
||||
|
||||
/// <summary>
|
||||
/// Re-loads the permissions of an player in case their admin data changed DB-side.
|
||||
/// </summary>
|
||||
/// <seealso cref="ReloadAdminsWithRank"/>
|
||||
void ReloadAdmin(IPlayerSession player);
|
||||
void ReloadAdmin(ICommonSession player);
|
||||
|
||||
/// <summary>
|
||||
/// Reloads admin permissions for all admins with a certain rank.
|
||||
@@ -57,7 +56,7 @@ namespace Content.Server.Administration.Managers
|
||||
|
||||
void Initialize();
|
||||
|
||||
void PromoteHost(IPlayerSession player);
|
||||
void PromoteHost(ICommonSession player);
|
||||
|
||||
bool TryGetCommandFlags(CommandSpec command, out AdminFlags[]? flags);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ using System.Collections.Immutable;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Database;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Administration.Managers;
|
||||
|
||||
@@ -55,5 +55,5 @@ public interface IBanManager
|
||||
/// Sends role bans to the target
|
||||
/// </summary>
|
||||
/// <param name="pSession">Player's session</param>
|
||||
public void SendRoleBans(IPlayerSession pSession);
|
||||
public void SendRoleBans(ICommonSession pSession);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Players.PlayTimeTracking;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Administration.Notes;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using Content.Server.Administration.Commands;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.EUI;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Administration.Notes;
|
||||
|
||||
@@ -2,7 +2,7 @@ using System.Threading.Tasks;
|
||||
using Content.Server.Database;
|
||||
using Content.Shared.Administration.Notes;
|
||||
using Content.Shared.Database;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Administration.Notes;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Shared.Administration;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Administration;
|
||||
|
||||
@@ -16,7 +16,7 @@ public sealed partial class QuickDialogSystem
|
||||
/// <param name="cancelAction">The action to execute upon the dialog being cancelled.</param>
|
||||
/// <typeparam name="T1">Type of the input.</typeparam>
|
||||
[PublicAPI]
|
||||
public void OpenDialog<T1>(IPlayerSession session, string title, string prompt, Action<T1> okAction,
|
||||
public void OpenDialog<T1>(ICommonSession session, string title, string prompt, Action<T1> okAction,
|
||||
Action? cancelAction = null)
|
||||
{
|
||||
OpenDialogInternal(
|
||||
@@ -53,7 +53,7 @@ public sealed partial class QuickDialogSystem
|
||||
/// <typeparam name="T1">Type of the first input.</typeparam>
|
||||
/// <typeparam name="T2">Type of the second input.</typeparam>
|
||||
[PublicAPI]
|
||||
public void OpenDialog<T1, T2>(IPlayerSession session, string title, string prompt1, string prompt2,
|
||||
public void OpenDialog<T1, T2>(ICommonSession session, string title, string prompt1, string prompt2,
|
||||
Action<T1, T2> okAction, Action? cancelAction = null)
|
||||
{
|
||||
OpenDialogInternal(
|
||||
@@ -96,7 +96,7 @@ public sealed partial class QuickDialogSystem
|
||||
/// <typeparam name="T2">Type of the second input.</typeparam>
|
||||
/// <typeparam name="T3">Type of the third input.</typeparam>
|
||||
[PublicAPI]
|
||||
public void OpenDialog<T1, T2, T3>(IPlayerSession session, string title, string prompt1, string prompt2,
|
||||
public void OpenDialog<T1, T2, T3>(ICommonSession session, string title, string prompt1, string prompt2,
|
||||
string prompt3, Action<T1, T2, T3> okAction, Action? cancelAction = null)
|
||||
{
|
||||
OpenDialogInternal(
|
||||
@@ -142,7 +142,7 @@ public sealed partial class QuickDialogSystem
|
||||
/// <typeparam name="T3">Type of the third input.</typeparam>
|
||||
/// <typeparam name="T4">Type of the fourth input.</typeparam>
|
||||
[PublicAPI]
|
||||
public void OpenDialog<T1, T2, T3, T4>(IPlayerSession session, string title, string prompt1, string prompt2,
|
||||
public void OpenDialog<T1, T2, T3, T4>(ICommonSession session, string title, string prompt1, string prompt2,
|
||||
string prompt3, string prompt4, Action<T1, T2, T3, T4> okAction, Action? cancelAction = null)
|
||||
{
|
||||
OpenDialogInternal(
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.Administration;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Interfaces;
|
||||
|
||||
namespace Content.Server.Administration;
|
||||
|
||||
@@ -87,7 +84,7 @@ public sealed partial class QuickDialogSystem : EntitySystem
|
||||
_openDialogsByUser.Remove(user);
|
||||
}
|
||||
|
||||
private void OpenDialogInternal(IPlayerSession session, string title, List<QuickDialogEntry> entries, QuickDialogButtonFlag buttons, Action<QuickDialogResponseEvent> okAction, Action cancelAction)
|
||||
private void OpenDialogInternal(ICommonSession session, string title, List<QuickDialogEntry> entries, QuickDialogButtonFlag buttons, Action<QuickDialogResponseEvent> okAction, Action cancelAction)
|
||||
{
|
||||
var did = GetDialogId();
|
||||
RaiseNetworkEvent(
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace Content.Server.Administration.Systems
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdatePlayerList(IPlayerSession player)
|
||||
public void UpdatePlayerList(ICommonSession player)
|
||||
{
|
||||
_playerList[player.UserId] = GetPlayerInfo(player.Data, player);
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace Content.Server.Administration.Systems
|
||||
UpdatePanicBunker();
|
||||
}
|
||||
|
||||
private void SendFullPlayerList(IPlayerSession playerSession)
|
||||
private void SendFullPlayerList(ICommonSession playerSession)
|
||||
{
|
||||
var ev = new FullPlayerListEvent();
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace Content.Server.Administration.Systems
|
||||
RaiseNetworkEvent(ev, playerSession.ConnectedClient);
|
||||
}
|
||||
|
||||
private PlayerInfo GetPlayerInfo(IPlayerData data, IPlayerSession? session)
|
||||
private PlayerInfo GetPlayerInfo(SessionData data, ICommonSession? session)
|
||||
{
|
||||
var name = data.UserName;
|
||||
var entityName = string.Empty;
|
||||
@@ -326,7 +326,7 @@ namespace Content.Server.Administration.Systems
|
||||
/// chat messages and showing a popup to other players.
|
||||
/// Their items are dropped on the ground.
|
||||
/// </summary>
|
||||
public void Erase(IPlayerSession player)
|
||||
public void Erase(ICommonSession player)
|
||||
{
|
||||
var entity = player.AttachedEntity;
|
||||
_chat.DeleteMessagesBy(player);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Administration.Systems;
|
||||
|
||||
@@ -20,7 +20,7 @@ public sealed class AdminTestArenaSystem : EntitySystem
|
||||
public Dictionary<NetUserId, EntityUid> ArenaMap { get; private set; } = new();
|
||||
public Dictionary<NetUserId, EntityUid?> ArenaGrid { get; private set; } = new();
|
||||
|
||||
public (EntityUid Map, EntityUid? Grid) AssertArenaLoaded(IPlayerSession admin)
|
||||
public (EntityUid Map, EntityUid? Grid) AssertArenaLoaded(ICommonSession admin)
|
||||
{
|
||||
if (ArenaMap.TryGetValue(admin.UserId, out var arenaMap) && !Deleted(arenaMap) && !Terminating(arenaMap))
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Server.Disposal.Tube;
|
||||
using Content.Server.Disposal.Tube.Components;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Ghost.Roles;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Commands;
|
||||
using Content.Server.Prayer;
|
||||
using Content.Server.Xenoarchaeology.XenoArtifacts;
|
||||
@@ -18,17 +19,15 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Toolshed;
|
||||
@@ -56,7 +55,7 @@ namespace Content.Server.Administration.Systems
|
||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||
[Dependency] private readonly PrayerSystem _prayerSystem = default!;
|
||||
[Dependency] private readonly EuiManager _eui = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly MindSystem _mindSystem = default!;
|
||||
[Dependency] private readonly ToolshedManager _toolshed = default!;
|
||||
[Dependency] private readonly RejuvenateSystem _rejuvenate = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
@@ -277,12 +276,7 @@ namespace Content.Server.Administration.Systems
|
||||
// TODO VERB ICON control mob icon
|
||||
Act = () =>
|
||||
{
|
||||
MakeSentientCommand.MakeSentient(args.Target, EntityManager);
|
||||
|
||||
if (!_minds.TryGetMind(player, out var mindId, out var mind))
|
||||
return;
|
||||
|
||||
_mindSystem.TransferTo(mindId, args.Target, ghostCheckOverride: true, mind: mind);
|
||||
_mindSystem.ControlMob(args.User, args.Target);
|
||||
},
|
||||
Impact = LogImpact.High,
|
||||
ConfirmationPopup = true
|
||||
@@ -358,7 +352,7 @@ namespace Content.Server.Administration.Systems
|
||||
var message = ExamineSystemShared.InRangeUnOccluded(args.User, args.Target)
|
||||
? Loc.GetString("in-range-unoccluded-verb-on-activate-not-occluded")
|
||||
: Loc.GetString("in-range-unoccluded-verb-on-activate-occluded");
|
||||
|
||||
|
||||
_popup.PopupEntity(message, args.Target, args.User);
|
||||
}
|
||||
};
|
||||
@@ -432,7 +426,7 @@ namespace Content.Server.Administration.Systems
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenEditSolutionsEui(IPlayerSession session, EntityUid uid)
|
||||
public void OpenEditSolutionsEui(ICommonSession session, EntityUid uid)
|
||||
{
|
||||
if (session.AttachedEntity == null)
|
||||
return;
|
||||
|
||||
@@ -17,6 +17,7 @@ using Robust.Shared;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -119,7 +120,7 @@ namespace Content.Server.Administration.Systems
|
||||
_typingUpdateTimestamps[args.SenderSession.UserId] = (_timing.RealTime, msg.Typing);
|
||||
|
||||
// Non-admins can only ever type on their own ahelp, guard against fake messages
|
||||
var isAdmin = _adminManager.GetAdminData((IPlayerSession) args.SenderSession)?.HasFlag(AdminFlags.Adminhelp) ?? false;
|
||||
var isAdmin = _adminManager.GetAdminData(args.SenderSession)?.HasFlag(AdminFlags.Adminhelp) ?? false;
|
||||
var channel = isAdmin ? msg.Channel : args.SenderSession.UserId;
|
||||
var update = new BwoinkPlayerTypingUpdated(channel, args.SenderSession.Name, msg.Typing);
|
||||
|
||||
@@ -376,7 +377,7 @@ namespace Content.Server.Administration.Systems
|
||||
protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySessionEventArgs eventArgs)
|
||||
{
|
||||
base.OnBwoinkTextMessage(message, eventArgs);
|
||||
var senderSession = (IPlayerSession) eventArgs.SenderSession;
|
||||
var senderSession = eventArgs.SenderSession;
|
||||
|
||||
// TODO: Sanitize text?
|
||||
// Confirm that this person is actually allowed to send a message here.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Toolshed;
|
||||
|
||||
namespace Content.Server.Administration.Toolshed;
|
||||
@@ -11,13 +11,13 @@ public sealed class AdminsCommand : ToolshedCommand
|
||||
[Dependency] private readonly IAdminManager _admin = default!;
|
||||
|
||||
[CommandImplementation("active")]
|
||||
public IEnumerable<IPlayerSession> Active()
|
||||
public IEnumerable<ICommonSession> Active()
|
||||
{
|
||||
return _admin.ActiveAdmins;
|
||||
}
|
||||
|
||||
[CommandImplementation("all")]
|
||||
public IEnumerable<IPlayerSession> All()
|
||||
public IEnumerable<ICommonSession> All()
|
||||
{
|
||||
return _admin.AllAdmins;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user