Package dev.jorel.commandapi
Class CommandAPIBukkit<Source>
java.lang.Object
dev.jorel.commandapi.CommandAPIBukkit<Source>
- All Implemented Interfaces:
BukkitPlatform<Source>,CommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidcreateDispatcherFile(File file, com.mojang.brigadier.CommandDispatcher<Source> dispatcher) static <Source> CommandAPIBukkit<Source> get()final com.mojang.brigadier.CommandDispatcher<Source> getBrigadierSourceFromCommandSender(AbstractCommandSender<? extends org.bukkit.command.CommandSender> sender) BukkitCommandSender<? extends org.bukkit.command.CommandSender> static InternalBukkitConfiggetNMS()org.bukkit.plugin.java.JavaPluginBukkitCommandSender<? extends org.bukkit.command.CommandSender> getSenderForCommand(com.mojang.brigadier.context.CommandContext<Source> cmdCtx, boolean forceNative) com.mojang.brigadier.suggestion.SuggestionProvider<Source> getSuggestionProvider(SuggestionProviders suggestionProvider) static <T> voidinitializeNBTAPI(Class<T> nbtContainerClass, Function<Object, T> nbtContainerConstructor) Initializes the CommandAPI's implementation of an NBT API.newConcreteCommandAPICommand(dev.jorel.commandapi.CommandMetaData<org.bukkit.command.CommandSender> meta) newConcreteLiteralArgument(String nodeName, String literal) newConcreteMultiLiteralArgument(String nodeName, String[] literals) voidvoidonLoad()voidpostCommandRegistration(RegisteredCommand registeredCommand, com.mojang.brigadier.tree.LiteralCommandNode<Source> resultantNode, List<com.mojang.brigadier.tree.LiteralCommandNode<Source>> aliasNodes) voidpreCommandRegistration(String commandName) voidregisterBukkitRecipesSafely(Iterator<org.bukkit.inventory.Recipe> recipes) com.mojang.brigadier.tree.LiteralCommandNode<Source> registerCommandNode(com.mojang.brigadier.builder.LiteralArgumentBuilder<Source> node, String namespace) voidregisterPermission(String string) voidprotected voidvoidunregister(String commandName, boolean unregisterNamespaces) static voidunregister(String commandName, boolean unregisterNamespaces, boolean unregisterBukkit) Unregisters a command from the CommandGraph, so it can't be run anymore.voidupdateRequirements(AbstractPlayer<?> player) abstract BukkitCommandSender<? extends org.bukkit.command.CommandSender> wrapCommandSender(org.bukkit.command.CommandSender sender) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.jorel.commandapi.BukkitPlatform
activePlatform, createCommandRegistrationStrategy, getCommandMapMethods inherited from interface dev.jorel.commandapi.CommandAPIPlatform
onEnable
-
Field Details
-
config
-
plugin
protected org.bukkit.plugin.java.JavaPlugin plugin -
nms
-
-
Constructor Details
-
CommandAPIBukkit
protected CommandAPIBukkit()
-
-
Method Details
-
get
-
getPlugin
public org.bukkit.plugin.java.JavaPlugin getPlugin() -
getNMS
-
getConfiguration
-
getCommandRegistrationStrategy
-
onLoad
public void onLoad()- Specified by:
onLoadin interfaceBukkitPlatform<Source>- Specified by:
onLoadin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
stopCommandRegistrations
protected void stopCommandRegistrations() -
checkDependencies
protected void checkDependencies() -
onDisable
public void onDisable()- Specified by:
onDisablein interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
wrapCommandSender
public abstract BukkitCommandSender<? extends org.bukkit.command.CommandSender> wrapCommandSender(org.bukkit.command.CommandSender sender) - Specified by:
wrapCommandSenderin interfaceBukkitPlatform<Source>- Specified by:
wrapCommandSenderin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
registerPermission
- Specified by:
registerPermissionin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
preCommandRegistration
- Specified by:
preCommandRegistrationin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
postCommandRegistration
public void postCommandRegistration(RegisteredCommand registeredCommand, com.mojang.brigadier.tree.LiteralCommandNode<Source> resultantNode, List<com.mojang.brigadier.tree.LiteralCommandNode<Source>> aliasNodes) - Specified by:
postCommandRegistrationin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
registerCommandNode
public com.mojang.brigadier.tree.LiteralCommandNode<Source> registerCommandNode(com.mojang.brigadier.builder.LiteralArgumentBuilder<Source> node, String namespace) - Specified by:
registerCommandNodein interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
unregister
- Specified by:
unregisterin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
unregister
public static void unregister(String commandName, boolean unregisterNamespaces, boolean unregisterBukkit) Unregisters a command from the CommandGraph, so it can't be run anymore. This Bukkit-specific unregister has an additional parameter,unregisterBukkit, compared toCommandAPI.unregister(String, boolean).- Parameters:
commandName- the name of the command to unregisterunregisterNamespaces- whether the unregistration system should attempt to remove versions of the command that start with a namespace. E.g. `minecraft:command`, `bukkit:command`, or `plugin:command`. If true, these namespaced versions of a command are also unregistered.unregisterBukkit- whether the unregistration system should unregister Vanilla or Bukkit commands. If true, only Bukkit commands are unregistered, otherwise only Vanilla commands are unregistered. For the purposes of this parameter, commands registered using the CommandAPI are Vanilla commands, and commands registered by other plugin using Bukkit API are Bukkit commands.
-
setupMessenger
- Specified by:
setupMessengerin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
getMessenger
- Specified by:
getMessengerin interfaceBukkitPlatform<Source>
-
getBrigadierDispatcher
- Specified by:
getBrigadierDispatcherin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
getLogger
- Specified by:
getLoggerin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
updateRequirements
- Specified by:
updateRequirementsin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
newConcreteMultiLiteralArgument
- Specified by:
newConcreteMultiLiteralArgumentin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
newConcreteLiteralArgument
- Specified by:
newConcreteLiteralArgumentin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
newConcreteCommandAPICommand
public CommandAPICommand newConcreteCommandAPICommand(dev.jorel.commandapi.CommandMetaData<org.bukkit.command.CommandSender> meta) - Specified by:
newConcreteCommandAPICommandin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
initializeNBTAPI
public static <T> void initializeNBTAPI(Class<T> nbtContainerClass, Function<Object, T> nbtContainerConstructor) Initializes the CommandAPI's implementation of an NBT API. If you are shading the CommandAPI, you should be usingCommandAPIBukkitConfig.initializeNBTAPI(Class, Function)in youronLoadmethod instead of calling this method.- Type Parameters:
T- the type that the NBT compound container class is- Parameters:
nbtContainerClass- the NBT compound container class. For example,NBTContainer.classnbtContainerConstructor- a function that takes an Object (NMSNBTTagCompound) and returns an instance of the provided NBT compound container. For example,NBTContainer::new.
-
registerBukkitRecipesSafely
-
getSenderForCommand
public BukkitCommandSender<? extends org.bukkit.command.CommandSender> getSenderForCommand(com.mojang.brigadier.context.CommandContext<Source> cmdCtx, boolean forceNative) - Specified by:
getSenderForCommandin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
getBrigadierSourceFromCommandSender
public Source getBrigadierSourceFromCommandSender(AbstractCommandSender<? extends org.bukkit.command.CommandSender> sender) - Specified by:
getBrigadierSourceFromCommandSenderin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
getSuggestionProvider
public com.mojang.brigadier.suggestion.SuggestionProvider<Source> getSuggestionProvider(SuggestionProviders suggestionProvider) - Specified by:
getSuggestionProviderin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
getCommandSenderFromCommandSource
public BukkitCommandSender<? extends org.bukkit.command.CommandSender> getCommandSenderFromCommandSource(Source css) - Specified by:
getCommandSenderFromCommandSourcein interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
createDispatcherFile
public void createDispatcherFile(File file, com.mojang.brigadier.CommandDispatcher<Source> dispatcher) throws IOException - Specified by:
createDispatcherFilein interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source> - Throws:
IOException
-
reloadDataPacks
public void reloadDataPacks()- Specified by:
reloadDataPacksin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-