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