public ECommandRunError ExecuteCommand(string text, PointBlankPlayer executor) { string[] info = ParseCommand(text); List <string> args = new List <string>(); CommandWrapper wrapper = Commands.FirstOrDefault(a => a.Commands.FirstOrDefault(b => b.ToLower() == info[0].ToLower()) != null && a.Enabled); string permission = ""; if (wrapper == null) { PointBlankPlayer.SendMessage(executor, Environment.ServiceTranslations[typeof(ServiceTranslations)].Translations["CommandManager_Invalid"], ConsoleColor.Red); return(ECommandRunError.COMMAND_NOT_EXIST); } permission = wrapper.Permission; if (info.Length > 1) { for (int i = 1; i < info.Length; i++) { args.Add(info[i]); } } if (args.Count > 0) { permission += "." + string.Join(".", args.ToArray()); } if (!PointBlankPlayer.IsServer(executor) && !executor.HasPermission(permission)) { PointBlankPlayer.SendMessage(executor, Environment.ServiceTranslations[typeof(ServiceTranslations)].Translations["CommandManager_NotEnoughPermissions"], ConsoleColor.Red); return(ECommandRunError.NO_PERMISSION); } return(wrapper.Execute(executor, args.ToArray())); }
public override void Execute(PointBlankPlayer executor, string[] args) { string admins = string.Join(",", Provider.clients.Where(a => a.isAdmin).Select(a => a.playerID.playerName).ToArray()); if (executor == null) { CommandWindow.Log(Translations["Admins_List"] + admins, ConsoleColor.Green); } else { if (Provider.hideAdmins && !executor.HasPermission("unturned.revealadmins")) { executor.SendMessage(Translations["Admins_Hidden"], Color.red); return; } executor.SendMessage(Translations["Admins_List"] + admins, Color.green); } }