create commands bukkit code example
Example 1: bukkit register commands
public class main {
@Override
public void onEnable() {
this.getCommand("heal").setExecuter(new health(this));
}
}
public class health {
private main plugin;
public health(main plugin) { this.plugin = plugin; }
public boolean onCommand(CommandSender sender, Command cmd, String Label, String[] args) {
}
}
Example 2: Java Bukkit
Basics 1:
- Java Plugin implementieren:
public void Main extends JavaPlugin{
}
- Wenn Aktiviert (onEnbale) Methode erstellen:
public void Main extends JavaPlugin{
public void onEnable(){
}
}
- Konsolen anzeige in onEnable Methode:
public void Main extends JavaPlugin{
public void onEnable(){
System.out.println("Das Plugin wurde aktiviert.");
}
}