/// <summary> /// Executes command with context /// </summary> /// <param name="context">Context of command</param> /// <returns>Success state</returns> public bool Execute(CommandContext context) { // Sender of command ICommandSender sender = context.Sender; if (!sender.IsPermised(info.PermissionLevel)) { sender.SendMessage(ColorScheme.ERROR, "Error", "You do not have permission to do that"); return(true); } // Make sure required arguments are provided bool correctUsage = context.HasArgs(info.RequiredArgs); if (correctUsage) { // Now perform try { Perform(context); } catch (Exception e) { Debug.WriteLine(e.ToString()); return(false); } } else { this.SendUsageMessage(sender); } return(true); }
/// <summary> /// Executes command with context /// </summary> /// <param name="context">Context of command</param> /// <returns>Success state</returns> public bool Execute(CommandContext context) { // Sender of command ICommandSender sender = context.Sender; if (!sender.IsPermised(info.PermissionLevel)) { sender.SendMessage(ColorScheme.ERROR, "Error", "You do not have permission to do that"); return(true); } // Make sure required arguments are provided if (context.HasArgs(info.RequiredArgs)) { this.SendUsageMessage(sender); } else { // Now perform Perform(context); } return(true); }