Answers for "spigot commands with args"

0

spigot multi arg command

public class CommandName implements CommandExecutor {
	@Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
		if (args.length < 1) {
			Util.sendtoplayer((Player) sender, "$cInvalid amount of args");
		}
		if (args[0].equals("subcommandname")) {
			//do stuff
		} else if (args[0].equals("othersubcommandname")) {
			//do more things
		}
        return true;
    }
}
Posted by: Guest on July-11-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language