Package dev.jorel.commandapi
Class SpigotCommandRegistration<Source>
java.lang.Object
dev.jorel.commandapi.CommandRegistrationStrategy<Source>
dev.jorel.commandapi.SpigotCommandRegistration<Source>
Handles logic for registering commands on Spigot and old versions of Paper
-
Constructor Summary
ConstructorsConstructorDescriptionSpigotCommandRegistration(com.mojang.brigadier.CommandDispatcher<Source> brigadierDispatcher, org.bukkit.command.SimpleCommandMap commandMap, Supplier<com.mojang.brigadier.CommandDispatcher<Source>> getResourcesDispatcher, Predicate<org.bukkit.command.Command> isVanillaCommandWrapper, Function<com.mojang.brigadier.tree.CommandNode<Source>, org.bukkit.command.Command> wrapToVanillaCommandWrapper, Predicate<com.mojang.brigadier.tree.CommandNode<Source>> isBukkitCommandWrapper) -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.brigadier.CommandDispatcher<Source> com.mojang.brigadier.CommandDispatcher<Source> Returns the Brigadier CommandDispatcher used when commands are sent to PlayersbooleanisBukkitCommandWrapper(com.mojang.brigadier.tree.CommandNode<Source> node) Checks if a Brigadier command node is being handled by Bukkit's BukkitCommandWrapperbooleanisVanillaCommandWrapper(org.bukkit.command.Command command) Checks if a Command is an instance of the OBC VanillaCommandWrappervoidpostCommandRegistration(RegisteredCommand registeredCommand, com.mojang.brigadier.tree.LiteralCommandNode<Source> resultantNode, List<com.mojang.brigadier.tree.LiteralCommandNode<Source>> aliasNodes) voidcom.mojang.brigadier.tree.LiteralCommandNode<Source> registerCommandNode(com.mojang.brigadier.builder.LiteralArgumentBuilder<Source> node, String namespace) voidvoidunregister(String commandName, boolean unregisterNamespaces, boolean unregisterBukkit) org.bukkit.command.CommandwrapToVanillaCommandWrapper(com.mojang.brigadier.tree.CommandNode<Source> node) Wraps a Brigadier command node as Bukkit's VanillaCommandWrapperMethods inherited from class dev.jorel.commandapi.CommandRegistrationStrategy
isThisTheCommandButNamespaced, removeBrigadierCommands, removeCommandFromMapIfCheckPasses, removeCommandNamespace
-
Constructor Details
-
SpigotCommandRegistration
public SpigotCommandRegistration(com.mojang.brigadier.CommandDispatcher<Source> brigadierDispatcher, org.bukkit.command.SimpleCommandMap commandMap, Supplier<com.mojang.brigadier.CommandDispatcher<Source>> getResourcesDispatcher, Predicate<org.bukkit.command.Command> isVanillaCommandWrapper, Function<com.mojang.brigadier.tree.CommandNode<Source>, org.bukkit.command.Command> wrapToVanillaCommandWrapper, Predicate<com.mojang.brigadier.tree.CommandNode<Source>> isBukkitCommandWrapper)
-
-
Method Details
-
getResourcesDispatcher
Returns the Brigadier CommandDispatcher used when commands are sent to Players- Returns:
- A Brigadier CommandDispatcher
-
isVanillaCommandWrapper
public boolean isVanillaCommandWrapper(org.bukkit.command.Command command) Checks if a Command is an instance of the OBC VanillaCommandWrapper- Parameters:
command- The Command to check- Returns:
- true if Command is an instance of VanillaCommandWrapper
-
wrapToVanillaCommandWrapper
public org.bukkit.command.Command wrapToVanillaCommandWrapper(com.mojang.brigadier.tree.CommandNode<Source> node) Wraps a Brigadier command node as Bukkit's VanillaCommandWrapper- Parameters:
node- The LiteralCommandNode to wrap- Returns:
- A VanillaCommandWrapper representing the given node
-
isBukkitCommandWrapper
Checks if a Brigadier command node is being handled by Bukkit's BukkitCommandWrapper- Parameters:
node- The CommandNode to check- Returns:
- true if the CommandNode is being handled by Bukkit's BukkitCommandWrapper
-
getBrigadierDispatcher
- Specified by:
getBrigadierDispatcherin classCommandRegistrationStrategy<Source>
-
runTasksAfterServerStart
public void runTasksAfterServerStart()- Specified by:
runTasksAfterServerStartin classCommandRegistrationStrategy<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 classCommandRegistrationStrategy<Source>
-
registerCommandNode
public com.mojang.brigadier.tree.LiteralCommandNode<Source> registerCommandNode(com.mojang.brigadier.builder.LiteralArgumentBuilder<Source> node, String namespace) - Specified by:
registerCommandNodein classCommandRegistrationStrategy<Source>
-
unregister
- Specified by:
unregisterin classCommandRegistrationStrategy<Source>
-
preReloadDataPacks
public void preReloadDataPacks()- Specified by:
preReloadDataPacksin classCommandRegistrationStrategy<Source>
-