Class EnchantmentMock

java.lang.Object
org.bukkit.enchantments.Enchantment
be.seeseemelk.mockbukkit.enchantments.EnchantmentMock
All Implemented Interfaces:
net.kyori.adventure.key.Keyed, net.kyori.adventure.translation.Translatable, org.bukkit.Keyed, org.bukkit.Translatable

public class EnchantmentMock extends org.bukkit.enchantments.Enchantment
Mock implementation of an Enchantment.
  • Field Summary

    Fields inherited from class org.bukkit.enchantments.Enchantment

    AQUA_AFFINITY, BANE_OF_ARTHROPODS, BINDING_CURSE, BLAST_PROTECTION, BREACH, CHANNELING, DENSITY, DEPTH_STRIDER, EFFICIENCY, FEATHER_FALLING, FIRE_ASPECT, FIRE_PROTECTION, FLAME, FORTUNE, FROST_WALKER, IMPALING, INFINITY, KNOCKBACK, LOOTING, LOYALTY, LUCK_OF_THE_SEA, LURE, MENDING, MULTISHOT, PIERCING, POWER, PROJECTILE_PROTECTION, PROTECTION, PUNCH, QUICK_CHARGE, RESPIRATION, RIPTIDE, SHARPNESS, SILK_TOUCH, SMITE, SOUL_SPEED, SWEEPING_EDGE, SWIFT_SNEAK, THORNS, UNBREAKING, VANISHING_CURSE, WIND_BURST
  • Constructor Summary

    Constructors
    Constructor
    Description
    EnchantmentMock(com.google.gson.JsonObject data)
    Deprecated, for removal: This API element is subject to removal in a future version.
    EnchantmentMock(org.bukkit.NamespacedKey key, boolean treasure, boolean cursed, int maxLevel, int startLevel, String name, net.kyori.adventure.text.Component[] displayNames, int[] minModifiedCost, int[] maxModifiedCost, boolean tradeable, boolean discoverable, Set<org.bukkit.NamespacedKey> conflicts)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canEnchantItem(@NotNull org.bukkit.inventory.ItemStack item)
     
    boolean
    conflictsWith(@NotNull org.bukkit.enchantments.Enchantment other)
     
    @NotNull net.kyori.adventure.text.Component
    displayName(int level)
     
    from(com.google.gson.JsonObject data)
     
    @NotNull Set<org.bukkit.inventory.EquipmentSlot>
     
    int
     
    float
    getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityCategory entityCategory)
     
    float
    getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityType entityType)
     
    @NotNull org.bukkit.enchantments.EnchantmentTarget
    Deprecated, for removal: This API element is subject to removal in a future version.
    @NotNull org.bukkit.NamespacedKey
     
    int
     
    int
    getMaxModifiedCost(int level)
     
    int
    getMinModifiedCost(int level)
     
    @NotNull String
     
    @NotNull io.papermc.paper.enchantments.EnchantmentRarity
     
    int
     
    @NotNull String
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    void
    setCursed(boolean isCursed)
    Sets the return value of isCursed().
    void
    setItemTarget(@NotNull org.bukkit.enchantments.EnchantmentTarget itemTarget)
    Deprecated, for removal: This API element is subject to removal in a future version.
    void
    setMaxLevel(int maxLevel)
    Sets the return value of getMaxLevel().
    void
    setStartLevel(int startLevel)
    Sets the return value of getStartLevel().
    void
    setTreasure(boolean isTreasure)
    Sets the return value of isTreasure().
    @NotNull String
     

    Methods inherited from class org.bukkit.enchantments.Enchantment

    getByKey, getByName, values

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.bukkit.Keyed

    key
  • Constructor Details

    • EnchantmentMock

      public EnchantmentMock(org.bukkit.NamespacedKey key, boolean treasure, boolean cursed, int maxLevel, int startLevel, String name, net.kyori.adventure.text.Component[] displayNames, int[] minModifiedCost, int[] maxModifiedCost, boolean tradeable, boolean discoverable, Set<org.bukkit.NamespacedKey> conflicts)
      Parameters:
      key - The key representing this enchantment
      treasure - Whether this enchantment can be found in a treasure
      cursed - Whether this enchantment is a curse
      maxLevel - The max level of this enchantment
      startLevel - The min level of this enchantment
      name - The name of the enchantment
      displayNames - The display name of the enchantment dependent on level
      minModifiedCost - The minimal modified cost for this enchantment dependent on level
      maxModifiedCost - The maximal modified cost for this enchantment dependent on level
      tradeable - Whether this enchantment can be obtained from trades
      discoverable - Whether this enchantment is in a loot table
      conflicts - Namespaced-keys of enchantments that are conflicting with this enchantment
    • EnchantmentMock

      @Deprecated(forRemoval=true) public EnchantmentMock(com.google.gson.JsonObject data)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Parameters:
      data - Json data
  • Method Details

    • displayName

      @NotNull public @NotNull net.kyori.adventure.text.Component displayName(int level)
      Specified by:
      displayName in class org.bukkit.enchantments.Enchantment
    • isTradeable

      public boolean isTradeable()
      Specified by:
      isTradeable in class org.bukkit.enchantments.Enchantment
    • isDiscoverable

      public boolean isDiscoverable()
      Specified by:
      isDiscoverable in class org.bukkit.enchantments.Enchantment
    • getMaxModifiedCost

      public int getMaxModifiedCost(int level)
      Specified by:
      getMaxModifiedCost in class org.bukkit.enchantments.Enchantment
    • getAnvilCost

      public int getAnvilCost()
      Specified by:
      getAnvilCost in class org.bukkit.enchantments.Enchantment
    • getMinModifiedCost

      public int getMinModifiedCost(int level)
      Specified by:
      getMinModifiedCost in class org.bukkit.enchantments.Enchantment
    • getRarity

      @NotNull public @NotNull io.papermc.paper.enchantments.EnchantmentRarity getRarity()
      Specified by:
      getRarity in class org.bukkit.enchantments.Enchantment
    • getDamageIncrease

      public float getDamageIncrease(int level, @NotNull @NotNull org.bukkit.entity.EntityCategory entityCategory)
      Specified by:
      getDamageIncrease in class org.bukkit.enchantments.Enchantment
    • getDamageIncrease

      public float getDamageIncrease(int level, @NotNull @NotNull org.bukkit.entity.EntityType entityType)
      Specified by:
      getDamageIncrease in class org.bukkit.enchantments.Enchantment
    • getActiveSlots

      @NotNull public @NotNull Set<org.bukkit.inventory.EquipmentSlot> getActiveSlots()
      Specified by:
      getActiveSlots in class org.bukkit.enchantments.Enchantment
    • translationKey

      @NotNull public @NotNull String translationKey()
    • getName

      @NotNull public @NotNull String getName()
      Specified by:
      getName in class org.bukkit.enchantments.Enchantment
    • getMaxLevel

      public int getMaxLevel()
      Specified by:
      getMaxLevel in class org.bukkit.enchantments.Enchantment
    • setMaxLevel

      public void setMaxLevel(int maxLevel)
      Sets the return value of getMaxLevel().
      Parameters:
      maxLevel - The max level.
      See Also:
    • getStartLevel

      public int getStartLevel()
      Specified by:
      getStartLevel in class org.bukkit.enchantments.Enchantment
    • setStartLevel

      public void setStartLevel(int startLevel)
      Sets the return value of getStartLevel().
      Parameters:
      startLevel - The start level.
      See Also:
    • getItemTarget

      @Deprecated(forRemoval=true, since="1.20.5") @NotNull public @NotNull org.bukkit.enchantments.EnchantmentTarget getItemTarget()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getItemTarget in class org.bukkit.enchantments.Enchantment
    • setItemTarget

      @Deprecated(forRemoval=true) public void setItemTarget(@NotNull @NotNull org.bukkit.enchantments.EnchantmentTarget itemTarget)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the return value of getItemTarget().
      Parameters:
      itemTarget - The item target.
      See Also:
    • isTreasure

      public boolean isTreasure()
      Specified by:
      isTreasure in class org.bukkit.enchantments.Enchantment
    • setTreasure

      public void setTreasure(boolean isTreasure)
      Sets the return value of isTreasure().
      Parameters:
      isTreasure - Whether the enchantment is treasure.
      See Also:
    • isCursed

      public boolean isCursed()
      Specified by:
      isCursed in class org.bukkit.enchantments.Enchantment
    • setCursed

      public void setCursed(boolean isCursed)
      Sets the return value of isCursed().
      Parameters:
      isCursed - Whether the enchantment is cursed.
      See Also:
    • conflictsWith

      public boolean conflictsWith(@NotNull @NotNull org.bukkit.enchantments.Enchantment other)
      Specified by:
      conflictsWith in class org.bukkit.enchantments.Enchantment
    • canEnchantItem

      public boolean canEnchantItem(@NotNull @NotNull org.bukkit.inventory.ItemStack item)
      Specified by:
      canEnchantItem in class org.bukkit.enchantments.Enchantment
    • getKey

      @NotNull public @NotNull org.bukkit.NamespacedKey getKey()
    • getTranslationKey

      @NotNull public @NotNull String getTranslationKey()
    • from

      @Internal public static EnchantmentMock from(com.google.gson.JsonObject data)