adminmenu fixes (#5305)

This commit is contained in:
Paul Ritter
2021-11-12 19:46:05 +01:00
committed by GitHub
parent e8232af00e
commit 7b48fdd7f5
3 changed files with 40 additions and 1 deletions

View File

@@ -2,6 +2,8 @@ using System;
using System.Linq;
using Content.Server.Administration.Managers;
using Content.Server.Players;
using Content.Server.Roles;
using Content.Server.Traitor;
using Content.Shared.Administration;
using Content.Shared.Administration.Events;
using Robust.Server.GameObjects;
@@ -25,11 +27,28 @@ namespace Content.Server.Administration
_adminManager.OnPermsChanged += OnAdminPermsChanged;
SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<PlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<RoleAddedEvent>(OnRoleAddedEvent);
}
private void OnRoleAddedEvent(RoleAddedEvent ev)
{
if (ev.Role.Antagonist && ev.Role.Mind.Session != null)
{
foreach (var admin in _adminManager.ActiveAdmins)
{
RaiseNetworkEvent(GetChangedEvent(ev.Role.Mind.Session), admin.ConnectedClient);
}
}
}
private void OnAdminPermsChanged(AdminPermsChangedEventArgs obj)
{
if(!obj.IsAdmin) return;
if(!obj.IsAdmin)
{
RaiseNetworkEvent(new FullPlayerListEvent(), obj.Player.ConnectedClient);
return;
}
SendFullPlayerList(obj.Player);
}