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