fixes adminmenus sins (fixes it)
This commit is contained in:
@@ -16,10 +16,9 @@ namespace Content.Client.Administration.UI.CustomControls
|
|||||||
[GenerateTypedNameReferences]
|
[GenerateTypedNameReferences]
|
||||||
public partial class PlayerListControl : BoxContainer
|
public partial class PlayerListControl : BoxContainer
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
|
||||||
private readonly AdminSystem _adminSystem;
|
private readonly AdminSystem _adminSystem;
|
||||||
|
|
||||||
public event Action<ICommonSession?>? OnSelectionChanged;
|
public event Action<PlayerInfo?>? OnSelectionChanged;
|
||||||
|
|
||||||
public PlayerListControl()
|
public PlayerListControl()
|
||||||
{
|
{
|
||||||
@@ -45,7 +44,7 @@ namespace Content.Client.Administration.UI.CustomControls
|
|||||||
|
|
||||||
private void PlayerItemListOnOnItemSelected(ItemList.ItemListSelectedEventArgs obj)
|
private void PlayerItemListOnOnItemSelected(ItemList.ItemListSelectedEventArgs obj)
|
||||||
{
|
{
|
||||||
var selectedPlayer = (ICommonSession) obj.ItemList[obj.ItemIndex].Metadata!;
|
var selectedPlayer = (PlayerInfo) obj.ItemList[obj.ItemIndex].Metadata!;
|
||||||
OnSelectionChanged?.Invoke(selectedPlayer);
|
OnSelectionChanged?.Invoke(selectedPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +67,7 @@ namespace Content.Client.Administration.UI.CustomControls
|
|||||||
|
|
||||||
PlayerItemList.Add(new ItemList.Item(PlayerItemList)
|
PlayerItemList.Add(new ItemList.Item(PlayerItemList)
|
||||||
{
|
{
|
||||||
Metadata = _playerManager.SessionsDict[info.SessionId],
|
Metadata = info,
|
||||||
Text = displayName
|
Text = displayName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using JetBrains.Annotations;
|
using Content.Shared.Administration;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.Console;
|
using Robust.Client.Console;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
@@ -13,7 +14,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminTab
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public partial class PlayerActionsWindow : SS14Window
|
public partial class PlayerActionsWindow : SS14Window
|
||||||
{
|
{
|
||||||
private ICommonSession? _selectedSession;
|
private PlayerInfo? _selectedPlayer;
|
||||||
|
|
||||||
protected override void EnteredTree()
|
protected override void EnteredTree()
|
||||||
{
|
{
|
||||||
@@ -23,10 +24,10 @@ namespace Content.Client.Administration.UI.Tabs.AdminTab
|
|||||||
PlayerList.OnSelectionChanged += OnListOnOnSelectionChanged;
|
PlayerList.OnSelectionChanged += OnListOnOnSelectionChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnListOnOnSelectionChanged(ICommonSession? obj)
|
private void OnListOnOnSelectionChanged(PlayerInfo? obj)
|
||||||
{
|
{
|
||||||
_selectedSession = obj;
|
_selectedPlayer = obj;
|
||||||
var disableButtons = _selectedSession == null;
|
var disableButtons = _selectedPlayer == null;
|
||||||
SubmitKickButton.Disabled = disableButtons;
|
SubmitKickButton.Disabled = disableButtons;
|
||||||
SubmitAHelpButton.Disabled = disableButtons;
|
SubmitAHelpButton.Disabled = disableButtons;
|
||||||
SubmitRespawnButton.Disabled = disableButtons;
|
SubmitRespawnButton.Disabled = disableButtons;
|
||||||
@@ -34,26 +35,27 @@ namespace Content.Client.Administration.UI.Tabs.AdminTab
|
|||||||
|
|
||||||
private void SubmitKickButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
private void SubmitKickButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
||||||
{
|
{
|
||||||
if (_selectedSession == null)
|
if (_selectedPlayer == null)
|
||||||
return;
|
return;
|
||||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||||
$"kick \"{_selectedSession.Name}\" \"{CommandParsing.Escape(ReasonLine.Text)}\"");
|
$"kick \"{_selectedPlayer.Username}\" \"{CommandParsing.Escape(ReasonLine.Text)}\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SubmitAhelpButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
private void SubmitAhelpButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
||||||
{
|
{
|
||||||
if (_selectedSession == null)
|
if (_selectedPlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||||
$"openahelp \"{_selectedSession.UserId}\"");
|
$"openahelp \"{_selectedPlayer.SessionId}\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SubmitRespawnButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
private void SubmitRespawnButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
||||||
{
|
{
|
||||||
if (_selectedSession == null)
|
if (_selectedPlayer == null)
|
||||||
return;
|
return;
|
||||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||||
$"respawn \"{_selectedSession.Name}\"");
|
$"respawn \"{_selectedPlayer.Username}\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using JetBrains.Annotations;
|
using Content.Shared.Administration;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.Console;
|
using Robust.Client.Console;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
@@ -12,7 +13,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminTab
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public partial class TeleportWindow : SS14Window
|
public partial class TeleportWindow : SS14Window
|
||||||
{
|
{
|
||||||
private ICommonSession? _selectedSession;
|
private PlayerInfo? _selectedPlayer;
|
||||||
|
|
||||||
protected override void EnteredTree()
|
protected override void EnteredTree()
|
||||||
{
|
{
|
||||||
@@ -20,19 +21,19 @@ namespace Content.Client.Administration.UI.Tabs.AdminTab
|
|||||||
PlayerList.OnSelectionChanged += OnListOnOnSelectionChanged;
|
PlayerList.OnSelectionChanged += OnListOnOnSelectionChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnListOnOnSelectionChanged(ICommonSession? obj)
|
private void OnListOnOnSelectionChanged(PlayerInfo? obj)
|
||||||
{
|
{
|
||||||
_selectedSession = obj;
|
_selectedPlayer = obj;
|
||||||
SubmitButton.Disabled = _selectedSession == null;
|
SubmitButton.Disabled = _selectedPlayer == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
private void SubmitButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||||
{
|
{
|
||||||
if (_selectedSession == null)
|
if (_selectedPlayer == null)
|
||||||
return;
|
return;
|
||||||
// Execute command
|
// Execute command
|
||||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||||
$"tpto \"{_selectedSession.Name}\"");
|
$"tpto \"{_selectedPlayer.Username}\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ namespace Content.Server.Administration
|
|||||||
|
|
||||||
private void OnPlayerDetached(PlayerDetachedEvent ev)
|
private void OnPlayerDetached(PlayerDetachedEvent ev)
|
||||||
{
|
{
|
||||||
|
if(ev.Player.Status == SessionStatus.Disconnected) return;
|
||||||
|
|
||||||
foreach (var admin in _adminManager.ActiveAdmins)
|
foreach (var admin in _adminManager.ActiveAdmins)
|
||||||
{
|
{
|
||||||
RaiseNetworkEvent(GetChangedEvent(ev.Player), admin.ConnectedClient);
|
RaiseNetworkEvent(GetChangedEvent(ev.Player), admin.ConnectedClient);
|
||||||
@@ -36,6 +38,8 @@ namespace Content.Server.Administration
|
|||||||
|
|
||||||
private void OnPlayerAttached(PlayerAttachedEvent ev)
|
private void OnPlayerAttached(PlayerAttachedEvent ev)
|
||||||
{
|
{
|
||||||
|
if(ev.Player.Status == SessionStatus.Disconnected) return;
|
||||||
|
|
||||||
foreach (var admin in _adminManager.ActiveAdmins)
|
foreach (var admin in _adminManager.ActiveAdmins)
|
||||||
{
|
{
|
||||||
RaiseNetworkEvent(GetChangedEvent(ev.Player), admin.ConnectedClient);
|
RaiseNetworkEvent(GetChangedEvent(ev.Player), admin.ConnectedClient);
|
||||||
|
|||||||
Reference in New Issue
Block a user