|
| 1 | +using CommandSystem; |
| 2 | +using Exiled.API.Features; |
| 3 | +using RemoteAdmin; |
| 4 | +using System; |
| 5 | +using System.Linq; |
| 6 | + |
| 7 | +namespace ServerPlugin.Command |
| 8 | +{ |
| 9 | + [CommandHandler(typeof(ClientCommandHandler))] |
| 10 | + public class AdminChat : ICommand,IUsageProvider |
| 11 | + { |
| 12 | + public string Command { get; } = "ac"; |
| 13 | + public string[] Aliases { get; } = new string[1] { "ac" }; |
| 14 | + public string Description { get; } = "呼叫管理员(不要使用该指令骚扰管理员)"; |
| 15 | + public string[] Usage { get; } = new string[] { "*文本" }; |
| 16 | + public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) |
| 17 | + { |
| 18 | + if (sender is PlayerCommandSender playerCommandSender) |
| 19 | + { |
| 20 | + int AdminCount = Player.List.Where(x => x.RemoteAdminAccess).ToList().Count; |
| 21 | + Player player = Player.Get(playerCommandSender.PlayerId); |
| 22 | + if (player.IsVerified && player != null) |
| 23 | + { |
| 24 | + if (arguments.Count > 0) |
| 25 | + { |
| 26 | + if (player.RemoteAdminAccess) |
| 27 | + { |
| 28 | + response = "<color=red>管理不能呼叫管理!</color>"; |
| 29 | + return true; |
| 30 | + } |
| 31 | + if (AdminCount != 0) |
| 32 | + { |
| 33 | + foreach (Player AdminPlayer in Player.List.Where(x => x.RemoteAdminAccess)) |
| 34 | + AdminPlayer.Broadcast(5, $"<size=55%><color=#00FFFF>[管理呼叫]</color> {player.Nickname} : {string.Join(" ", arguments)}</size>"); |
| 35 | + Log.Info($"[Plugin-Call]-[呼叫][{player.Nickname}][{player.UserId}]:[{string.Join(" ", arguments)}]"); |
| 36 | + } |
| 37 | + else |
| 38 | + { |
| 39 | + Log.Info($"[Plugin-Call]-[未响应呼叫][{player.Nickname}][{player.UserId}]:[{string.Join(" ", arguments)}]"); |
| 40 | + response = "<color=red>服务器暂无管理员!</color>"; |
| 41 | + return false; |
| 42 | + } |
| 43 | + } |
| 44 | + else |
| 45 | + { |
| 46 | + response = "<color=red>请输入文本!</color>"; |
| 47 | + return false; |
| 48 | + } |
| 49 | + } |
| 50 | + else |
| 51 | + { |
| 52 | + response = "<color=red>你还没加入服务器!</color>"; |
| 53 | + return false; |
| 54 | + } |
| 55 | + |
| 56 | + } |
| 57 | + response = "<color=green>信息已发送!</color>"; |
| 58 | + return true; |
| 59 | + } |
| 60 | + } |
| 61 | +} |
0 commit comments