Last change
on this file since 438 was 405, checked in by alloc, 21 months ago |
Refactored console commands for A21 caching
|
File size:
1.2 KB
|
Rev | Line | |
---|
[391] | 1 | using System.Collections.Generic;
|
---|
| 2 | using JetBrains.Annotations;
|
---|
| 3 |
|
---|
| 4 | namespace CommandExtensions.Commands {
|
---|
| 5 | [UsedImplicitly]
|
---|
| 6 | public class SayToPlayer : ConsoleCmdAbstract {
|
---|
[405] | 7 | protected override string getDescription () {
|
---|
[391] | 8 | return "send a message to a single player";
|
---|
| 9 | }
|
---|
| 10 |
|
---|
[405] | 11 | protected override string getHelp () {
|
---|
[391] | 12 | return "Usage:\n" +
|
---|
| 13 | " pm <player name / steam id / entity id> <message>\n" +
|
---|
| 14 | "Send a PM to the player given by the player name or entity id (as given by e.g. \"lpi\").";
|
---|
| 15 | }
|
---|
| 16 |
|
---|
[405] | 17 | protected override string[] getCommands () {
|
---|
[391] | 18 | return new[] {"sayplayer", "pm"};
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | private void RunInternal (ClientInfo _sender, List<string> _params) {
|
---|
| 22 | if (_params.Count < 2) {
|
---|
| 23 | SdtdConsole.Instance.Output ("Usage: sayplayer <playername|entityid> <message>");
|
---|
| 24 | return;
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | string message = _params [1];
|
---|
| 28 |
|
---|
| 29 | ClientInfo receiver = ConsoleHelper.ParseParamIdOrName (_params [0]);
|
---|
| 30 | if (receiver != null) {
|
---|
| 31 | ChatHelpers.SendMessage (receiver, _sender, message);
|
---|
| 32 | } else {
|
---|
| 33 | SdtdConsole.Instance.Output ("Playername or entity ID not found.");
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) {
|
---|
| 38 | RunInternal (_senderInfo.RemoteClientInfo, _params);
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.