Package dev.jorel.commandapi
Class CommandAPIBukkit<Source>
java.lang.Object
dev.jorel.commandapi.CommandAPIBukkit<Source>
- All Implemented Interfaces:
CommandAPIPlatform<Argument<?>,,org.bukkit.command.CommandSender, Source> NMS<Source>
public abstract class CommandAPIBukkit<Source>
extends Object
implements CommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender,Source>, NMS<Source>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidcreateDispatcherFile(File file, com.mojang.brigadier.CommandDispatcher<Source> brigadierDispatcher) failWithAdventureComponent(net.kyori.adventure.text.Component message) Forces a command to return a success value of 0failWithBaseComponents(net.md_5.bungee.api.chat.BaseComponent... message) Forces a command to return a success value of 0static <Source> CommandAPIBukkit<Source> get()final com.mojang.brigadier.CommandDispatcher<Source> abstract SourcegetBrigadierSourceFromCommandSender(AbstractCommandSender<? extends org.bukkit.command.CommandSender> sender) abstract BukkitCommandSender<? extends org.bukkit.command.CommandSender> static InternalBukkitConfigabstract <T> TgetPaper()abstract BukkitCommandSender<? extends org.bukkit.command.CommandSender> getSenderForCommand(com.mojang.brigadier.context.CommandContext<Source> cmdCtx, boolean forceNative) abstract com.mojang.brigadier.suggestion.SuggestionProvider<Source> getSuggestionProvider(SuggestionProviders suggestionProvider) Retrieve a specific NMS implemented SuggestionProviderstatic <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) voidvoidonEnable()voidonLoad(CommandAPIConfig<?> config) voidpostCommandRegistration(RegisteredCommand registeredCommand, com.mojang.brigadier.tree.LiteralCommandNode<Source> resultantNode, List<com.mojang.brigadier.tree.LiteralCommandNode<Source>> aliasNodes) voidpreCommandRegistration(String commandName) protected 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) abstract voidReloads the datapacks by using the updated the commandDispatcher treevoidunregister(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) 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.nms.NMS
_ArgumentAngle, _ArgumentAxis, _ArgumentBlockPredicate, _ArgumentBlockState, _ArgumentChat, _ArgumentChatComponent, _ArgumentChatFormat, _ArgumentDimension, _ArgumentEnchantment, _ArgumentEntity, _ArgumentEntitySummon, _ArgumentFloatRange, _ArgumentIntRange, _ArgumentItemPredicate, _ArgumentItemStack, _ArgumentMathOperation, _ArgumentMinecraftKeyRegistered, _ArgumentMobEffect, _ArgumentNBTCompound, _ArgumentParticle, _ArgumentPosition, _ArgumentPosition2D, _ArgumentProfile, _ArgumentRotation, _ArgumentScoreboardCriteria, _ArgumentScoreboardObjective, _ArgumentScoreboardSlot, _ArgumentScoreboardTeam, _ArgumentScoreholder, _ArgumentSyntheticBiome, _ArgumentTag, _ArgumentTime, _ArgumentUUID, _ArgumentVec2, _ArgumentVec3, compatibleVersions, convert, convert, convert, convert, createCommandRegistrationStrategy, generateHelpTopic, generateMessageFromJson, getAdvancement, getAdventureChat, getAdventureChatColor, getAdventureChatComponent, getAngle, getAxis, getBiome, getBlockPredicate, getBlockState, getChat, getChatColor, getChatComponent, getDimension, getEnchantment, getEntitySelector, getEntityType, getFloatRange, getFunction, getFunction, getFunctions, getHelpMap, getIntRange, getItemStack, getItemStackPredicate, getLocation2DBlock, getLocation2DPrecise, getLocationBlock, getLocationPrecise, getLootTable, getMathOperation, getMinecraftKey, getNBTCompound, getObjective, getObjectiveCriteria, getOfflinePlayer, getParticle, getPlayer, getPotionEffect, getRecipe, getRotation, getScoreboardSlot, getScoreHolderMultiple, getScoreHolderSingle, getSimpleCommandMap, getSound, getTag, getTags, getTeam, getTime, getUUID, getWorldForCSS
-
Constructor Details
-
CommandAPIBukkit
protected CommandAPIBukkit()
-
-
Method Details
-
get
-
getPaper
-
getConfiguration
-
getCommandRegistrationStrategy
-
onLoad
- Specified by:
onLoadin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
onEnable
public void onEnable()- Specified by:
onEnablein interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
onDisable
public void onDisable()- Specified by:
onDisablein interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
getSenderForCommand
public abstract 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>
-
getCommandSenderFromCommandSource
public abstract BukkitCommandSender<? extends org.bukkit.command.CommandSender> getCommandSenderFromCommandSource(Source cs) - Specified by:
getCommandSenderFromCommandSourcein interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
getBrigadierSourceFromCommandSender
public abstract Source getBrigadierSourceFromCommandSender(AbstractCommandSender<? extends org.bukkit.command.CommandSender> sender) - Specified by:
getBrigadierSourceFromCommandSenderin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
wrapCommandSender
public BukkitCommandSender<? extends org.bukkit.command.CommandSender> wrapCommandSender(org.bukkit.command.CommandSender sender) - Specified by:
wrapCommandSenderin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
registerPermission
- Specified by:
registerPermissionin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
getSuggestionProvider
public abstract com.mojang.brigadier.suggestion.SuggestionProvider<Source> getSuggestionProvider(SuggestionProviders suggestionProvider) Description copied from interface:NMSRetrieve a specific NMS implemented SuggestionProvider- Specified by:
getSuggestionProviderin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source> - Specified by:
getSuggestionProviderin interfaceNMS<Source>- Parameters:
suggestionProvider- The SuggestionProvider type to retrieve- Returns:
- A SuggestionProvider that matches the SuggestionProviders input
-
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.
-
getBrigadierDispatcher
- Specified by:
getBrigadierDispatcherin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
createDispatcherFile
public abstract void createDispatcherFile(File file, com.mojang.brigadier.CommandDispatcher<Source> brigadierDispatcher) throws IOException - Specified by:
createDispatcherFilein interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source> - Throws:
IOException
-
getMinecraftServer
public abstract <T> T getMinecraftServer() -
getLogger
- Specified by:
getLoggerin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source>
-
reloadDataPacks
public abstract void reloadDataPacks()Description copied from interface:NMSReloads the datapacks by using the updated the commandDispatcher tree- Specified by:
reloadDataPacksin interfaceCommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender, Source> - Specified by:
reloadDataPacksin interfaceNMS<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>
-
failWithBaseComponents
public static WrapperCommandSyntaxException failWithBaseComponents(net.md_5.bungee.api.chat.BaseComponent... message) Forces a command to return a success value of 0- Parameters:
message- Description of the error message, formatted as an array of base components- Returns:
- a
WrapperCommandSyntaxExceptionthat wraps Brigadier'sCommandSyntaxException
-
failWithAdventureComponent
public static WrapperCommandSyntaxException failWithAdventureComponent(net.kyori.adventure.text.Component message) Forces a command to return a success value of 0- Parameters:
message- Description of the error message, formatted as an adventure chat component- Returns:
- a
WrapperCommandSyntaxExceptionthat wraps Brigadier'sCommandSyntaxException
-
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 usingCommandAPIConfig.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
-