Last change
on this file since 460 was 405, checked in by alloc, 21 months ago |
Refactored console commands for A21 caching
|
File size:
1.3 KB
|
Line | |
---|
1 | using System.Collections.Generic;
|
---|
2 | using JetBrains.Annotations;
|
---|
3 |
|
---|
4 | namespace CommandExtensions.Commands {
|
---|
5 | [UsedImplicitly]
|
---|
6 | public class Reply : ConsoleCmdAbstract {
|
---|
7 | protected override string getDescription () {
|
---|
8 | return "send a message to the player who last sent you a PM";
|
---|
9 | }
|
---|
10 |
|
---|
11 | protected override string getHelp () {
|
---|
12 | return "Usage:\n" +
|
---|
13 | " reply <message>\n" +
|
---|
14 | "Send the given message to the user you last received a PM from.";
|
---|
15 | }
|
---|
16 |
|
---|
17 | protected override string[] getCommands () {
|
---|
18 | return new[] {"reply", "re"};
|
---|
19 | }
|
---|
20 |
|
---|
21 | private void RunInternal (ClientInfo _sender, List<string> _params) {
|
---|
22 | if (_params.Count < 1) {
|
---|
23 | SdtdConsole.Instance.Output ("Usage: reply <message>");
|
---|
24 | return;
|
---|
25 | }
|
---|
26 |
|
---|
27 | string message = _params [0];
|
---|
28 |
|
---|
29 | ClientInfo receiver = PrivateMessageConnections.GetLastPMSenderForPlayer (_sender);
|
---|
30 | if (receiver != null) {
|
---|
31 | ChatHelpers.SendMessage (receiver, _sender, message);
|
---|
32 | } else {
|
---|
33 | SdtdConsole.Instance.Output (
|
---|
34 | "You have not received a PM so far or sender of last received PM is no longer online.");
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) {
|
---|
39 | if (_senderInfo.RemoteClientInfo == null) {
|
---|
40 | Log.Out ("Command \"reply\" can only be used on clients!");
|
---|
41 | } else {
|
---|
42 | RunInternal (_senderInfo.RemoteClientInfo, _params);
|
---|
43 | }
|
---|
44 | }
|
---|
45 | }
|
---|
46 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.