Class NMS_Common

java.lang.Object
dev.jorel.commandapi.CommandAPIBukkit<net.minecraft.commands.CommandSourceStack>
dev.jorel.commandapi.nms.NMS_Common
All Implemented Interfaces:
CommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender,net.minecraft.commands.CommandSourceStack>, NMS<net.minecraft.commands.CommandSourceStack>

public abstract class NMS_Common extends CommandAPIBukkit<net.minecraft.commands.CommandSourceStack>
Common NMS code To ensure that this code actually works across all versions of Minecraft that this is supposed to support (1.17+), you should be compiling this code against all of the declared Maven profiles specified in this submodule's pom.xml file, by running the following commands:
  • mvn clean package -pl :commandapi-bukkit-nms-common -P Platform.Bukkit,Spigot_1_19_3_R2
  • mvn clean package -pl :commandapi-bukkit-nms-common -P Platform.Bukkit,Spigot_1_19_R1
  • mvn clean package -pl :commandapi-bukkit-nms-common -P Platform.Bukkit,Spigot_1_18_2_R2
  • mvn clean package -pl :commandapi-bukkit-nms-common -P Platform.Bukkit,Spigot_1_18_R1
  • mvn clean package -pl :commandapi-bukkit-nms-common -P Platform.Bukkit,Spigot_1_17_R1
Any of these that do not work should be removed or implemented otherwise (introducing another NMS_Common module perhaps?
  • Constructor Details

    • NMS_Common

      public NMS_Common()
  • Method Details

    • _ArgumentAngle

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentAngle()
    • _ArgumentAxis

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentAxis()
    • _ArgumentBlockPredicate

      public abstract com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentBlockPredicate()
    • _ArgumentBlockState

      public abstract com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentBlockState()
    • _ArgumentChat

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentChat()
    • _ArgumentChatComponent

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentChatComponent()
    • _ArgumentChatFormat

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentChatFormat()
    • _ArgumentDimension

      public com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentDimension()
    • _ArgumentEnchantment

      public abstract com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentEnchantment()
    • _ArgumentEntity

      public abstract com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentEntity(ArgumentSubType subType)
    • _ArgumentEntitySummon

      public abstract com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentEntitySummon()
    • _ArgumentFloatRange

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentFloatRange()
    • _ArgumentIntRange

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentIntRange()
    • _ArgumentItemPredicate

      public abstract com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentItemPredicate()
    • _ArgumentItemStack

      public abstract com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentItemStack()
    • _ArgumentMathOperation

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentMathOperation()
    • _ArgumentMinecraftKeyRegistered

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentMinecraftKeyRegistered()
    • _ArgumentMobEffect

      public abstract com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentMobEffect()
    • _ArgumentNBTCompound

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentNBTCompound()
    • _ArgumentParticle

      public abstract com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentParticle()
    • _ArgumentPosition

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentPosition()
    • _ArgumentPosition2D

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentPosition2D()
    • _ArgumentProfile

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentProfile()
    • _ArgumentRotation

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentRotation()
    • _ArgumentScoreboardCriteria

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentScoreboardCriteria()
    • _ArgumentScoreboardObjective

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentScoreboardObjective()
    • _ArgumentScoreboardSlot

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentScoreboardSlot()
    • _ArgumentScoreboardTeam

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentScoreboardTeam()
    • _ArgumentScoreholder

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentScoreholder(ArgumentSubType subType)
    • _ArgumentSyntheticBiome

      public abstract com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentSyntheticBiome()
    • _ArgumentTag

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentTag()
    • _ArgumentTime

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentTime()
    • _ArgumentUUID

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentUUID()
    • _ArgumentVec2

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentVec2(boolean centerPosition)
    • _ArgumentVec3

      public final com.mojang.brigadier.arguments.ArgumentType<?> _ArgumentVec3(boolean centerPosition)
    • getHelpMap

      public abstract Map<String,org.bukkit.help.HelpTopic> getHelpMap()
    • compatibleVersions

      public abstract String[] compatibleVersions()
    • convert

      public abstract String convert(org.bukkit.inventory.ItemStack is)
    • convert

      public abstract String convert(ParticleData<?> particle)
    • convert

      public final String convert(org.bukkit.potion.PotionEffectType potion)
    • convert

      public final String convert(org.bukkit.Sound sound)
    • createDispatcherFile

      public abstract void createDispatcherFile(File file, com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher) throws IOException
      Specified by:
      createDispatcherFile in interface CommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender,net.minecraft.commands.CommandSourceStack>
      Specified by:
      createDispatcherFile in class CommandAPIBukkit<net.minecraft.commands.CommandSourceStack>
      Throws:
      IOException
    • generateHelpTopic

      public abstract org.bukkit.help.HelpTopic generateHelpTopic(String commandName, String shortDescription, String fullDescription, String permission)
    • getAdvancement

      public abstract org.bukkit.advancement.Advancement getAdvancement(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getAdventureChat

      public final net.kyori.adventure.text.Component getAdventureChat(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getAdventureChatColor

      public abstract net.kyori.adventure.text.format.NamedTextColor getAdventureChatColor(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getAngle

      public final float getAngle(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getAxis

      public final EnumSet<org.bukkit.Axis> getAxis(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getBlockPredicate

      public abstract Predicate<org.bukkit.block.Block> getBlockPredicate(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getBlockState

      public abstract org.bukkit.block.data.BlockData getBlockState(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getBrigadierDispatcher

      public final com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> getBrigadierDispatcher()
      Specified by:
      getBrigadierDispatcher in interface CommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender,net.minecraft.commands.CommandSourceStack>
      Specified by:
      getBrigadierDispatcher in interface NMS<net.minecraft.commands.CommandSourceStack>
      Specified by:
      getBrigadierDispatcher in class CommandAPIBukkit<net.minecraft.commands.CommandSourceStack>
    • getResourcesDispatcher

      public abstract com.mojang.brigadier.CommandDispatcher<net.minecraft.commands.CommandSourceStack> getResourcesDispatcher()
    • getChat

      public final net.md_5.bungee.api.chat.BaseComponent[] getChat(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getChatColor

      public final org.bukkit.ChatColor getChatColor(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getChatComponent

      public final net.md_5.bungee.api.chat.BaseComponent[] getChatComponent(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getBrigadierSourceFromCommandSender

      public abstract net.minecraft.commands.CommandSourceStack getBrigadierSourceFromCommandSender(AbstractCommandSender<? extends org.bukkit.command.CommandSender> sender)
      Specified by:
      getBrigadierSourceFromCommandSender in interface CommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender,net.minecraft.commands.CommandSourceStack>
      Specified by:
      getBrigadierSourceFromCommandSender in class CommandAPIBukkit<net.minecraft.commands.CommandSourceStack>
    • getCommandSenderFromCommandSource

      public final BukkitCommandSender<? extends org.bukkit.command.CommandSender> getCommandSenderFromCommandSource(net.minecraft.commands.CommandSourceStack css)
      Specified by:
      getCommandSenderFromCommandSource in interface CommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender,net.minecraft.commands.CommandSourceStack>
      Specified by:
      getCommandSenderFromCommandSource in class CommandAPIBukkit<net.minecraft.commands.CommandSourceStack>
    • getDimension

      public abstract org.bukkit.World getDimension(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getEnchantment

      public abstract org.bukkit.enchantments.Enchantment getEnchantment(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getEntityType

      public abstract org.bukkit.entity.EntityType getEntityType(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getFloatRange

      public abstract FloatRange getFloatRange(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getFunction

      public abstract FunctionWrapper[] getFunction(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getFunction

      public SimpleFunctionWrapper getFunction(org.bukkit.NamespacedKey key)
    • getFunctions

      public Set<org.bukkit.NamespacedKey> getFunctions()
    • getIntRange

      public abstract IntegerRange getIntRange(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getItemStack

      public abstract org.bukkit.inventory.ItemStack getItemStack(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getItemStackPredicate

      public abstract Predicate<org.bukkit.inventory.ItemStack> getItemStackPredicate(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getLocation2DBlock

      public abstract Location2D getLocation2DBlock(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getLocation2DPrecise

      public Location2D getLocation2DPrecise(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getLocationBlock

      public abstract org.bukkit.Location getLocationBlock(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getLocationPrecise

      public abstract org.bukkit.Location getLocationPrecise(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getLootTable

      public abstract org.bukkit.loot.LootTable getLootTable(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getMathOperation

      public final MathOperation getMathOperation(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getMinecraftKey

      public org.bukkit.NamespacedKey getMinecraftKey(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getNBTCompound

      public final <NBTContainer> Object getNBTCompound(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key, Function<Object,NBTContainer> nbtContainerConstructor)
    • getObjective

      public org.bukkit.scoreboard.Objective getObjective(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getObjectiveCriteria

      public final String getObjectiveCriteria(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getOfflinePlayer

      public final org.bukkit.OfflinePlayer getOfflinePlayer(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getParticle

      public abstract ParticleData<?> getParticle(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getPlayer

      public final org.bukkit.entity.Player getPlayer(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getPotionEffect

      public abstract org.bukkit.potion.PotionEffectType getPotionEffect(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getRecipe

      public abstract org.bukkit.inventory.Recipe getRecipe(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getRotation

      public final Rotation getRotation(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getScoreboardSlot

      public abstract ScoreboardSlot getScoreboardSlot(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getScoreHolderMultiple

      public final Collection<String> getScoreHolderMultiple(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getScoreHolderSingle

      public final String getScoreHolderSingle(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getSenderForCommand

      public abstract BukkitCommandSender<? extends org.bukkit.command.CommandSender> getSenderForCommand(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, boolean isNative)
      Specified by:
      getSenderForCommand in interface CommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender,net.minecraft.commands.CommandSourceStack>
      Specified by:
      getSenderForCommand in class CommandAPIBukkit<net.minecraft.commands.CommandSourceStack>
    • getSimpleCommandMap

      public abstract org.bukkit.command.SimpleCommandMap getSimpleCommandMap()
    • getSound

      public abstract Object getSound(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key, ArgumentSubType subType)
    • getSuggestionProvider

      public abstract com.mojang.brigadier.suggestion.SuggestionProvider<net.minecraft.commands.CommandSourceStack> getSuggestionProvider(SuggestionProviders provider)
      Specified by:
      getSuggestionProvider in interface CommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender,net.minecraft.commands.CommandSourceStack>
      Specified by:
      getSuggestionProvider in interface NMS<net.minecraft.commands.CommandSourceStack>
      Specified by:
      getSuggestionProvider in class CommandAPIBukkit<net.minecraft.commands.CommandSourceStack>
    • getTag

      public abstract SimpleFunctionWrapper[] getTag(org.bukkit.NamespacedKey key)
    • getTags

      public final Set<org.bukkit.NamespacedKey> getTags()
    • getTeam

      public org.bukkit.scoreboard.Team getTeam(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getTime

      public final int getTime(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • getUUID

      public final UUID getUUID(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> cmdCtx, String key)
    • isVanillaCommandWrapper

      public abstract boolean isVanillaCommandWrapper(org.bukkit.command.Command command)
    • wrapToVanillaCommandWrapper

      public abstract org.bukkit.command.Command wrapToVanillaCommandWrapper(com.mojang.brigadier.tree.LiteralCommandNode<net.minecraft.commands.CommandSourceStack> node)
    • isBukkitCommandWrapper

      public abstract boolean isBukkitCommandWrapper(com.mojang.brigadier.tree.CommandNode<net.minecraft.commands.CommandSourceStack> node)
    • reloadDataPacks

      public abstract void reloadDataPacks()
      Specified by:
      reloadDataPacks in interface CommandAPIPlatform<Argument<?>,org.bukkit.command.CommandSender,net.minecraft.commands.CommandSourceStack>
      Specified by:
      reloadDataPacks in interface NMS<net.minecraft.commands.CommandSourceStack>
      Specified by:
      reloadDataPacks in class CommandAPIBukkit<net.minecraft.commands.CommandSourceStack>