bukkit register commands
public class main {
@Override
public void onEnable() {
this.getCommand("heal").setExecuter(new health(this));
//E.g a heal command in class health
// this.getCommand("heal").setExecture(new health(this))
//If command in main class replace new <class>() with this.
// this.getCommand("heal").setExecuter(this)
}
}
//If in external class a constructor has to be made.
public class health {
private main plugin;
//Have to create constructor in external class
public health(main plugin) { this.plugin = plugin; }
public boolean onCommand(CommandSender sender, Command cmd, String Label, String[] args) {
//Do stuff
}
}
Also in Java:
- how to pass parameters to xsl file
- android java add new record to Firebase Firestore
- java constructor genertic
- string replace java
- java instantiate collection with values
- java string to boolean
- How tomake teris in Java
- get last element of array java
- binary to int java
- java stack pop
- java int stream min
- how to interrupt a void java
- java set value of arraylist
- java get command line output
- how to add jar in maven java application in netbeans
- java get icon for file type
- how to count an replace string in java
- how to open a webpage with java
- how to install java 8 on terminal os
- update value of an arraylist java
- how to add an object to a list of objects in java
- throwing exceptions java
- Java array hashcode
- java enum