minecraft
Plugin-kommandon
Sök…
Hej kommando
I koden nedan kan du se hur du lägger till ett kommando till din plugin.
MainClass.java
package yourpackage;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
public class MainClass extends JavaPlugin {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("hello")) {
sender.sendMessage("Hey!");
}
return false;
}
}
Plugin.yml
name: HelloCommand
main: yourpackage.MainClass
version: 1.0
commands:
hello:
description: Hello
Modified text is an extract of the original Stack Overflow Documentation
Licensierat under CC BY-SA 3.0
Inte anslutet till Stack Overflow