public bool OnCommand(CommandSender sender, Command command, string[] args) { if(sender.HasPermission("yurikocs.command.exit")){ sender.SendMessage("Debug"); return true; }else{ sender.SendMessage("§cYou don't have permissions to execute this command"); return false; } }
public static bool Execute(CommandSender sender, string command) { command = command.Trim(); if(!StringFunctions.IsNullOrOnlySpaces(command)){ string[] args = null; if(command.Contains(" ")){ args = command.Substring(command.IndexOf(' ')).Split(' '); command = command.Substring(0, command.IndexOf(' ')); } if(registeredcmds.ContainsKey(command.ToLower())){ Permission permission = registeredcmds[command.ToLower()].GetCommandPermission(); if(permission == null || sender.HasPermission(permission.GetNode())){ return registeredcmds[command.ToLower()].GetExecutor().OnCommand(sender, registeredcmds[command.ToLower()], args); } sender.SendMessage("§cYou don't have permissions to execute this command"); return false; } sender.SendMessage("§cUnknown command. Use \"/help\" for a list of all available commands."); } return false; }