public void Use(Client client, string[] tokens) { if (tokens.Length == 1) { client.SendMessage("Use " + ChatColor.Teal + "/help build" + ChatColor.White + " for a list of building commands."); client.SendMessage("Use " + ChatColor.Teal + "/help mod" + ChatColor.White + " for a list of moderation commands."); client.SendMessage("Use " + ChatColor.Teal + "/help information" + ChatColor.White + " for a list of information commands."); client.SendMessage("Use " + ChatColor.Teal + "/help other" + ChatColor.White + " for a list of other commands."); client.SendMessage("Use " + ChatColor.Teal + "/help short" + ChatColor.White + " for a list of shortcuts."); } else if (tokens.Length > 1) { string message; switch (tokens[1].ToLower()) { case "build": message = (from ClientCommand c in ClientCommandHandler.GetCommands() where c.Type == CommandType.Build && client.CanUseCommand(c.Name) select c).Aggregate("", (current, c) => current + (", " + c.Name)); if (message == "") { client.SendMessage(ChatColor.Red + "There are no commands of this type that you can use."); return; } message = message.Remove(0, 1); client.SendMessage(message); break; case "mod": message = (from ClientCommand c in ClientCommandHandler.GetCommands() where c.Type == CommandType.Mod && client.CanUseCommand(c.Name) select c).Aggregate("", (current, c) => current + (", " + c.Name)); if (message == "") { client.SendMessage(ChatColor.Red + "There are no commands of this type that you can use."); return; } message = message.Remove(0, 1); client.SendMessage(message); break; case "information": case "info": message = (from ClientCommand c in ClientCommandHandler.GetCommands() where c.Type == CommandType.Information && client.CanUseCommand(c.Name) select c).Aggregate("", (current, c) => current + (", " + c.Name)); if (message == "") { client.SendMessage(ChatColor.Red + "There are no commands of this type that you can use."); return; } message = message.Remove(0, 1); client.SendMessage(message); break; case "other": message = (from ClientCommand c in ClientCommandHandler.GetCommands() where c.Type == CommandType.Other && client.CanUseCommand(c.Name) select c).Aggregate("", (current, c) => current + (", " + c.Name)); if (message == "") { client.SendMessage(ChatColor.Red + "There are no commands of this type that you can use."); return; } message = message.Remove(0, 1); client.SendMessage(message); break; case "short": message = (from ClientCommand c in ClientCommandHandler.GetCommands() where client.CanUseCommand(c.Name) && !string.IsNullOrEmpty(c.Shortcut) select c).Aggregate("", (current, c) => current + (", " + c.Shortcut)); if (message == "") { client.SendMessage(ChatColor.Red + "There are no commands of this type that you can use."); return; } message = message.Remove(0, 1); client.SendMessage(message); break; default: ClientCommand cmd; try { cmd = ClientCommandHandler.Find(tokens[1]) as ClientCommand; } catch (CommandNotFoundException e) { client.SendMessage(e.Message); return; } try { cmd.Help(client); client.SendMessage("Type: " + cmd.Type.ToString()); if (client.CanUseCommand(tokens[1])) { client.SendMessage(ChatColor.BrightGreen + "You can use this command."); } else { client.SendMessage(ChatColor.Red + "You cannot use this command."); } } catch(Exception e) { client.SendMessage("There was an error while accessing the help for this command."); client.Server.Logger.Log(e); } break; } } }