-
-
Save KILL3RTACO/444b87ee2d7902a75fc5 to your computer and use it in GitHub Desktop.
New TacoAPI Command Handling test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.kill3rtaco.testing.commands; | |
import org.bukkit.entity.Player; | |
import com.kill3rtaco.tacoapi.api.ncommands.Command; | |
import com.kill3rtaco.tacoapi.api.ncommands.CommandArguments; | |
import com.kill3rtaco.tacoapi.api.ncommands.CommandPermission; | |
import com.kill3rtaco.tacoapi.api.ncommands.ParentCommand; | |
public class Commands { | |
public Commands() { | |
} | |
@ParentCommand("takeo") | |
@Command(name = "noargs", aliases = {"na"}, desc = "Test command with no args") | |
public static void rawr(Player player, CommandArguments args) { | |
player.sendMessage("Success! - noargs"); | |
} | |
@ParentCommand("takeo") | |
@Command(name = "perm", desc = "Test with command permissions") | |
@CommandPermission("taco.testperm") | |
public static void perm(Player player, CommandArguments args) { | |
player.sendMessage("Success! - perm"); | |
} | |
@ParentCommand("takeo") | |
@Command(name = "args", args = "<sentence>", desc = "Test with argument joining") | |
public static void args(Player player, CommandArguments args) { | |
player.sendMessage("Success! - " + args.getJoinedArgs()); | |
} | |
@ParentCommand("empty") | |
@Command(name = "", desc = "Test with no arguments") | |
public static void empty(Player player, CommandArguments args) { | |
player.sendMessage("Success! - empty"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.kill3rtaco.testing.commands; | |
import org.bukkit.Bukkit; | |
import com.kill3rtaco.tacoapi.api.TacoPlugin; | |
import com.kill3rtaco.tacoapi.api.ncommands.CommandManager; | |
public class CommandsTest extends TacoPlugin { | |
private CommandManager commands = new CommandManager(this); | |
@Override | |
public void onStart() { | |
commands.reg(Commands.class); | |
chat.out(commands.commandsRegistered() + " commands registered"); | |
commands.onCommand(Bukkit.getConsoleSender(), getCommand("takeo"), "takeo", new String[]{ | |
"args", "this is a sentence"}); | |
} | |
@Override | |
public void onStop() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment