mirror of
https://github.com/aikar/commands.git
synced 2026-06-02 23:32:17 +00:00
add a new annotation to hide commands from tabcompletion and help (#124)
* add a new annotation to hide commands from tabcompletion and help (implements #123) * do the annotation lookup once
This commit is contained in:
@@ -44,6 +44,9 @@ public final class ACFExample extends JavaPlugin {
|
||||
// 1: Create Command Manager for your respective platform
|
||||
commandManager = new BukkitCommandManager(this);
|
||||
|
||||
// optional: enable unstable api to use help
|
||||
commandManager.enableUnstableAPI("help");
|
||||
|
||||
// 2: Setup some replacement values that may be used inside of the annotations dynamically.
|
||||
commandManager.getCommandReplacements().addReplacements(
|
||||
// key - value
|
||||
|
||||
@@ -24,8 +24,11 @@
|
||||
package co.aikar.acfexample;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.CommandHelp;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.HelpCommand;
|
||||
import co.aikar.commands.annotation.Private;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
@@ -37,4 +40,15 @@ public class SomeCommand_ExtraSubs extends BaseCommand {
|
||||
public void onTestSub2(CommandSender sender, String hi) {
|
||||
sender.sendMessage(hi);
|
||||
}
|
||||
|
||||
@Private
|
||||
@Subcommand("testsub private")
|
||||
public void privateSub(CommandSender sender){
|
||||
sender.sendMessage("Am a sneaky ninja!");
|
||||
}
|
||||
|
||||
@HelpCommand
|
||||
public void help(CommandSender sender, CommandHelp help){
|
||||
help.showHelp();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user