mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
asm: add rcon player menu option to kick, ban or unban player
This commit is contained in:
parent
466af960ae
commit
c9e6f2ec26
4 changed files with 62 additions and 0 deletions
|
|
@ -2723,6 +2723,9 @@ Undocumented bye wildcard.</sys:String>
|
|||
<sys:String x:Key="RCON_Menu_ViewTribe">View Tribe...</sys:String>
|
||||
<sys:String x:Key="RCON_Menu_CopyId">Copy ID...</sys:String>
|
||||
<sys:String x:Key="RCON_Menu_CopyPlayerId">Copy Player ID...</sys:String>
|
||||
<sys:String x:Key="RCON_Menu_KickPlayer">Kick Player</sys:String>
|
||||
<sys:String x:Key="RCON_Menu_BanPlayer">Ban Player</sys:String>
|
||||
<sys:String x:Key="RCON_Menu_UnbanPlayer">Unban Player</sys:String>
|
||||
|
||||
<sys:String x:Key="RCON_AdminNameLabel">Admin Name:</sys:String>
|
||||
<sys:String x:Key="RCON_AdminNameTooltip">This is the name used to prefix serverchat messages sent from the console.</sys:String>
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ namespace ServerManagerTool.Lib
|
|||
public const string RCON_COMMAND_GETCHAT = "getchat";
|
||||
public const string RCON_COMMAND_SERVERCHAT = "serverchat";
|
||||
public const string RCON_COMMAND_WILDDINOWIPE = "DestroyWildDinos";
|
||||
public const string RCON_COMMAND_KICKPLAYER = "KickPlayer";
|
||||
public const string RCON_COMMAND_BANPLAYER = "BanPlayer";
|
||||
public const string RCON_COMMAND_UNBANPLAYER = "UnbanPlayer";
|
||||
|
||||
public event EventHandler PlayersCollectionUpdated;
|
||||
|
||||
|
|
|
|||
|
|
@ -197,6 +197,11 @@
|
|||
<Separator/>
|
||||
<MenuItem Header="{DynamicResource RCON_Menu_CopyId}" Command="{Binding Source={StaticResource proxy}, Path=Data.CopyIDCommand}" CommandParameter="{Binding}"/>
|
||||
<MenuItem Header="{DynamicResource RCON_Menu_CopyPlayerId}" Command="{Binding Source={StaticResource proxy}, Path=Data.CopyPlayerIDCommand}" CommandParameter="{Binding}"/>
|
||||
<Separator/>
|
||||
<MenuItem Header="{DynamicResource RCON_Menu_KickPlayer}" Command="{Binding Source={StaticResource proxy}, Path=Data.KickPlayerProfileCommand}" CommandParameter="{Binding}" />
|
||||
<MenuItem Header="{DynamicResource RCON_Menu_BanPlayer}" Command="{Binding Source={StaticResource proxy}, Path=Data.BanPlayerTribeCommand}" CommandParameter="{Binding}"/>
|
||||
<MenuItem Header="{DynamicResource RCON_Menu_UnbanPlayer}" Command="{Binding Source={StaticResource proxy}, Path=Data.UnbanPlayerTribeCommand}" CommandParameter="{Binding}"/>
|
||||
<Separator/>
|
||||
</ContextMenu>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
|
|
|||
|
|
@ -645,6 +645,57 @@ namespace ServerManagerTool
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand KickPlayerProfileCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand<PlayerInfo>(
|
||||
execute: (player) =>
|
||||
{
|
||||
if (player.PlayerData != null)
|
||||
{
|
||||
this.ServerRCON.IssueCommand($"{ServerRcon.RCON_COMMAND_KICKPLAYER} {player.PlayerId.ToString()}");
|
||||
}
|
||||
},
|
||||
canExecute: (player) => player != null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BanPlayerProfileCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand<PlayerInfo>(
|
||||
execute: (player) =>
|
||||
{
|
||||
if (player.PlayerData != null)
|
||||
{
|
||||
this.ServerRCON.IssueCommand($"{ServerRcon.RCON_COMMAND_BANPLAYER} {player.PlayerId.ToString()}");
|
||||
}
|
||||
},
|
||||
canExecute: (player) => player != null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand UnbanPlayerProfileCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return new RelayCommand<PlayerInfo>(
|
||||
execute: (player) =>
|
||||
{
|
||||
if (player.PlayerData != null)
|
||||
{
|
||||
this.ServerRCON.IssueCommand($"{ServerRcon.RCON_COMMAND_UNBANPLAYER} {player.PlayerId.ToString()}");
|
||||
}
|
||||
},
|
||||
canExecute: (player) => player != null
|
||||
);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue