Class MockPlatform<CLW>

java.lang.Object
dev.jorel.commandapi.CommandAPIBukkit<CLW>
dev.jorel.commandapi.test.MockPlatform<CLW>
All Implemented Interfaces:
dev.jorel.commandapi.CommandAPIPlatform<dev.jorel.commandapi.arguments.Argument<?>,org.bukkit.command.CommandSender,CLW>, dev.jorel.commandapi.nms.NMS<CLW>

public abstract class MockPlatform<CLW> extends dev.jorel.commandapi.CommandAPIBukkit<CLW>
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract org.bukkit.advancement.Advancement
    addAdvancement(org.bukkit.NamespacedKey key)
     
    void
    addFunction(org.bukkit.NamespacedKey key, List<String> commands)
     
    void
    addTag(org.bukkit.NamespacedKey key, List<List<String>> commands)
     
    final void
    addToHelpMap(Map<String,org.bukkit.help.HelpTopic> helpTopicsToAdd)
     
    final String
    convert(dev.jorel.commandapi.wrappers.ParticleData<?> particle)
     
    final String
    convert(org.bukkit.inventory.ItemStack is)
     
    final String
    convert(org.bukkit.potion.PotionEffectType potion)
     
    final String
    convert(org.bukkit.Sound sound)
     
    abstract List<String>
     
    abstract List<org.bukkit.NamespacedKey>
     
    abstract org.bukkit.block.Biome[]
     
    final com.mojang.brigadier.CommandDispatcher<CLW>
     
    abstract String
    getBukkitPotionEffectTypeName(org.bukkit.potion.PotionEffectType potionEffectType)
    Converts 1.16.5 and below potion effect names to NamespacedKey names.
    abstract org.bukkit.enchantments.Enchantment[]
    Bukkit "enum" lists *
    abstract org.bukkit.entity.EntityType[]
     
    static Object
    getField(Class<?> className, String fieldName, Object instance)
    Helper methods *
    static <T> T
    getFieldAs(Class<?> className, String fieldName, Object instance, Class<T> asType)
     
    static <CLW> MockPlatform<CLW>
     
    abstract org.bukkit.inventory.ItemFactory
    Other stuff *
    abstract org.bukkit.loot.LootTables[]
     
    abstract String
    getNMSParticleNameFromBukkit(org.bukkit.Particle particle)
     
    abstract org.bukkit.potion.PotionEffectType[]
     
    final List<dev.jorel.commandapi.test.MockPlatform.Pair<String,com.google.gson.JsonObject>>
    getRecipes(Class<?> minecraftServerClass)
    Gets recipes from data/minecraft/recipes/<file>.json.
    final dev.jorel.commandapi.commandsenders.BukkitCommandSender<? extends org.bukkit.command.CommandSender>
    getSenderForCommand(com.mojang.brigadier.context.CommandContext<CLW> cmdCtx, boolean forceNative)
     
    abstract org.bukkit.Sound[]
     
    final boolean
    isVanillaCommandWrapper(org.bukkit.command.Command command)
     
    final void
     
    final void
    resendPackets(org.bukkit.entity.Player player)
     
    static void
    setField(Class<?> className, String fieldName, Object instance, Object value)
     
    static void
     

    Methods inherited from class dev.jorel.commandapi.CommandAPIBukkit

    createDispatcherFile, failWithAdventureComponent, failWithBaseComponents, get, getBrigadierSourceFromCommandSender, getCommandSenderFromCommandSource, getConfiguration, getLogger, getMinecraftServer, getPaper, getSuggestionProvider, newConcreteCommandAPICommand, newConcreteLiteralArgument, newConcreteMultiLiteralArgument, onDisable, onEnable, onLoad, postCommandRegistration, preCommandRegistration, registerBukkitRecipesSafely, registerCommandNode, registerPermission, unregister, updateRequirements, wrapCommandSender

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods 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, generateHelpTopic, generateMessageFromJson, getAdvancement, getAdventureChat, getAdventureChatComponent, getAngle, getAxis, getBiome, getBlockPredicate, getBlockState, getChat, getChatColor, getChatComponent, getDimension, getEnchantment, getEntitySelector, getEntityType, getFloatRange, getFunction, getFunction, getFunctions, 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

    • MockPlatform

      protected MockPlatform()
  • Method Details

    • getInstance

      public static <CLW> MockPlatform<CLW> getInstance()
    • unload

      public static void unload()
    • getBrigadierDispatcher

      public final com.mojang.brigadier.CommandDispatcher<CLW> getBrigadierDispatcher()
      Specified by:
      getBrigadierDispatcher in interface dev.jorel.commandapi.CommandAPIPlatform<dev.jorel.commandapi.arguments.Argument<?>,org.bukkit.command.CommandSender,CLW>
      Specified by:
      getBrigadierDispatcher in interface dev.jorel.commandapi.nms.NMS<CLW>
      Specified by:
      getBrigadierDispatcher in class dev.jorel.commandapi.CommandAPIBukkit<CLW>
    • getSenderForCommand

      public final dev.jorel.commandapi.commandsenders.BukkitCommandSender<? extends org.bukkit.command.CommandSender> getSenderForCommand(com.mojang.brigadier.context.CommandContext<CLW> cmdCtx, boolean forceNative)
      Specified by:
      getSenderForCommand in interface dev.jorel.commandapi.CommandAPIPlatform<dev.jorel.commandapi.arguments.Argument<?>,org.bukkit.command.CommandSender,CLW>
      Specified by:
      getSenderForCommand in class dev.jorel.commandapi.CommandAPIBukkit<CLW>
    • resendPackets

      public final void resendPackets(org.bukkit.entity.Player player)
    • addToHelpMap

      public final void addToHelpMap(Map<String,org.bukkit.help.HelpTopic> helpTopicsToAdd)
    • convert

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

      public final String convert(dev.jorel.commandapi.wrappers.ParticleData<?> particle)
    • convert

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

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

      public final boolean isVanillaCommandWrapper(org.bukkit.command.Command command)
    • reloadDataPacks

      public final void reloadDataPacks()
      Specified by:
      reloadDataPacks in interface dev.jorel.commandapi.CommandAPIPlatform<dev.jorel.commandapi.arguments.Argument<?>,org.bukkit.command.CommandSender,CLW>
      Specified by:
      reloadDataPacks in interface dev.jorel.commandapi.nms.NMS<CLW>
      Specified by:
      reloadDataPacks in class dev.jorel.commandapi.CommandAPIBukkit<CLW>
    • getField

      public static Object getField(Class<?> className, String fieldName, Object instance)
      Helper methods *
    • setField

      public static void setField(Class<?> className, String fieldName, Object instance, Object value)
    • getFieldAs

      public static <T> T getFieldAs(Class<?> className, String fieldName, Object instance, Class<T> asType)
    • getItemFactory

      public abstract org.bukkit.inventory.ItemFactory getItemFactory()
      Other stuff *
    • addAdvancement

      public abstract org.bukkit.advancement.Advancement addAdvancement(org.bukkit.NamespacedKey key)
    • addFunction

      public void addFunction(org.bukkit.NamespacedKey key, List<String> commands)
    • addTag

      public void addTag(org.bukkit.NamespacedKey key, List<List<String>> commands)
    • getBukkitPotionEffectTypeName

      public abstract String getBukkitPotionEffectTypeName(org.bukkit.potion.PotionEffectType potionEffectType)
      Converts 1.16.5 and below potion effect names to NamespacedKey names. For example, converts "effect.minecraft.speed" into "minecraft:speed"
      Parameters:
      potionEffectType - the potion effect to get the namespaced key for
      Returns:
      a Minecraft namespaced key name for a potion effect
    • getNMSParticleNameFromBukkit

      public abstract String getNMSParticleNameFromBukkit(org.bukkit.Particle particle)
    • getRecipes

      public final List<dev.jorel.commandapi.test.MockPlatform.Pair<String,com.google.gson.JsonObject>> getRecipes(Class<?> minecraftServerClass)
      Gets recipes from data/minecraft/recipes/<file>.json. Parses them and returns a list of {name, json}, where name is the name of the file without the .json extension, and json is the parsed JSON result from the file
      Parameters:
      minecraftServerClass - an instance of MinecraftServer.class
      Returns:
      A list of pairs of resource locations (with no namespace) and JSON objects
    • getEnchantments

      public abstract org.bukkit.enchantments.Enchantment[] getEnchantments()
      Bukkit "enum" lists *
    • getEntityTypes

      public abstract org.bukkit.entity.EntityType[] getEntityTypes()
    • getLootTables

      public abstract org.bukkit.loot.LootTables[] getLootTables()
    • getPotionEffects

      public abstract org.bukkit.potion.PotionEffectType[] getPotionEffects()
    • getSounds

      public abstract org.bukkit.Sound[] getSounds()
    • getBiomes

      public abstract org.bukkit.block.Biome[] getBiomes()
    • getAllItemNames

      public abstract List<String> getAllItemNames()
      Returns:
      A list of all item names, sorted in alphabetical order. Each item is prefixed with minecraft:
    • getAllRecipes

      public abstract List<org.bukkit.NamespacedKey> getAllRecipes()