Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @CommandAnnotation(name = "Help", description = "Lists all of the Commands Sail can run",usage = "[Type]")
- public String sailHelp() {
- Method[] methods = this.getClass().getMethods();
- String[] splitMessage = message.toString().split(" ");
- StringBuilder commandList = new StringBuilder();
- ArrayList<String> types = new ArrayList<>();
- if (message.toString().length() == getName("sailHelp").length()){
- for (Method m : methods) {
- if (m.isAnnotationPresent(CommandAnnotation.class)) {
- boolean typeFound = false;
- CommandAnnotation anno = m.getAnnotation(CommandAnnotation.class);
- for (String s : types){
- if (s.equalsIgnoreCase(anno.type())){
- typeFound = true;
- }
- }
- if (!typeFound){
- types.add(anno.type());
- }
- }
- }
- commandList.append("Here are the command types you can search from:");
- for (String s : types){
- commandList.append("\n " + s);
- }
- commandList.append("\nYou can search for commands with those types by doing \n`"+ getUsage("sailHelp") +"`");
- commandList.append("\nGitHub Page: <https://github.com/Vaerys-Dawn/S.A.I.L>");
- } else if (splitMessage[1].equalsIgnoreCase("Admin")){
- if (isMod || isAdmin) {
- commandList.append(helpHandler("Admin"));
- }else {
- return notAllowed;
- }
- } else if (splitMessage[1].equalsIgnoreCase("Race")){
- commandList.append(helpHandler("Race"));
- } else if (splitMessage[1].equalsIgnoreCase("Servers")){
- commandList.append(helpHandler("Servers"));
- } else if (splitMessage[1].equalsIgnoreCase("General")){
- commandList.append(helpHandler("General"));
- } else if (splitMessage[1].equalsIgnoreCase("CC")){
- commandList.append(helpHandler("CC"));
- } else {
- return getDescription("sailHelp");
- }
- return commandList.toString();
- }
Advertisement
Add Comment
Please, Sign In to add comment