using System.Collections.Generic; using JetBrains.Annotations; namespace CommandExtensions.Commands { [UsedImplicitly] public class SayToPlayer : ConsoleCmdAbstract { public override string GetDescription () { return "send a message to a single player"; } public override string GetHelp () { return "Usage:\n" + " pm \n" + "Send a PM to the player given by the player name or entity id (as given by e.g. \"lpi\")."; } public override string[] GetCommands () { return new[] {"sayplayer", "pm"}; } private void RunInternal (ClientInfo _sender, List _params) { if (_params.Count < 2) { SdtdConsole.Instance.Output ("Usage: sayplayer "); return; } string message = _params [1]; ClientInfo receiver = ConsoleHelper.ParseParamIdOrName (_params [0]); if (receiver != null) { ChatHelpers.SendMessage (receiver, _sender, message); } else { SdtdConsole.Instance.Output ("Playername or entity ID not found."); } } public override void Execute (List _params, CommandSenderInfo _senderInfo) { RunInternal (_senderInfo.RemoteClientInfo, _params); } } }