bukkit register commands

Solutions on MaxInterview for bukkit register commands by the best coders in the world

showing results for - "bukkit register commands"
Noemi
04 Mar 2019
1public class main {
2  @Override
3  public void onEnable() {
4      this.getCommand("heal").setExecuter(new health(this));
5      //E.g a heal command in class health
6      // this.getCommand("heal").setExecture(new health(this))
7
8      //If command in main class replace new <class>() with this.
9      // this.getCommand("heal").setExecuter(this)
10  }
11}
12
13//If in external class a constructor has to be made.
14public class health {
15  private main plugin;
16  //Have to create constructor in external class
17  public health(main plugin) { this.plugin = plugin; }  
18  
19  public boolean onCommand(CommandSender sender, Command cmd, String Label, String[] args) { 
20  	//Do stuff
21  }
22  
23}