Commande simple
package me.yourname.helloworld.commands;
import me.yourname.helloworld.Main;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class HelloCommand implements CommandExecutor {
private Main plugin;
public HelloCommand(Main plugin) {
this.plugin = plugin;
plugin.getCommand("hello").setExecutor(this);
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label,
String[] args) {
if (!(sender instanceof Player)){
sender.sendMessage("Only admins can use this command");
return true;
}
Player p = (Player) sender;
if (p.hasPermission("hello.use")) {
p.sendMessage("hi!");
return true;
} else{
p.sendMessage("You don't have perms to use this command");
}
return false;
}
}
---------------
simple simple simple HelloWorld command!
this is command and reply simple with spigot 1.8.8
ingame: /hello
reply: hi!
--------------
discord server:
https://discord.gg/tM9ANwk6