Advertisement
Guest User

Untitled

a guest
Jun 29th, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. package it.tristana.commons.command;
  2.  
  3. import java.util.Collection;
  4.  
  5. import org.bukkit.command.CommandSender;
  6.  
  7. import it.tristana.commons.helper.CommonsHelper;
  8.  
  9. public class CommandHelp extends SubCommand {
  10.  
  11.     public static final String COMMAND = "help";
  12.     private final Collection<SubCommand> commands;
  13.    
  14.     public CommandHelp(MainCommand main) {
  15.         super(main, COMMAND, null, false);
  16.         this.commands = main.getCommands().values();
  17.     }
  18.  
  19.     @Override
  20.     public void execute(CommandSender sender, String[] args) {
  21.         for (SubCommand command : commands) {
  22.             if (MainCommand.canExecute(sender, command)) {
  23.                 CommonsHelper.info(sender, command.getHelpMessage());
  24.             }
  25.         }
  26.     }
  27.    
  28.     @Override
  29.     public String getHelp() {
  30.         return "Displays the available commands";
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement