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
ConstructorsConstructorDescriptionEnchantmentMock(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 TypeMethodDescriptionbooleancanEnchantItem(@NotNull org.bukkit.inventory.ItemStack item) booleanconflictsWith(@NotNull org.bukkit.enchantments.Enchantment other) @NotNull net.kyori.adventure.text.ComponentdisplayName(int level) static EnchantmentMockfrom(com.google.gson.JsonObject data) @NotNull Set<org.bukkit.inventory.EquipmentSlot> intfloatgetDamageIncrease(int level, @NotNull org.bukkit.entity.EntityCategory entityCategory) floatgetDamageIncrease(int level, @NotNull org.bukkit.entity.EntityType entityType) @NotNull org.bukkit.enchantments.EnchantmentTargetDeprecated, for removal: This API element is subject to removal in a future version.@NotNull org.bukkit.NamespacedKeygetKey()intintgetMaxModifiedCost(int level) intgetMinModifiedCost(int level) @NotNull StringgetName()@NotNull io.papermc.paper.enchantments.EnchantmentRarityint@NotNull StringbooleanisCursed()booleanbooleanbooleanvoidsetCursed(boolean isCursed) Sets the return value ofisCursed().voidsetItemTarget(@NotNull org.bukkit.enchantments.EnchantmentTarget itemTarget) Deprecated, for removal: This API element is subject to removal in a future version.voidsetMaxLevel(int maxLevel) Sets the return value ofgetMaxLevel().voidsetStartLevel(int startLevel) Sets the return value ofgetStartLevel().voidsetTreasure(boolean isTreasure) Sets the return value ofisTreasure().@NotNull StringMethods inherited from class org.bukkit.enchantments.Enchantment
getByKey, getByName, valuesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 enchantmenttreasure- Whether this enchantment can be found in a treasurecursed- Whether this enchantment is a cursemaxLevel- The max level of this enchantmentstartLevel- The min level of this enchantmentname- The name of the enchantmentdisplayNames- The display name of the enchantment dependent on levelminModifiedCost- The minimal modified cost for this enchantment dependent on levelmaxModifiedCost- The maximal modified cost for this enchantment dependent on leveltradeable- Whether this enchantment can be obtained from tradesdiscoverable- Whether this enchantment is in a loot tableconflicts- Namespaced-keys of enchantments that are conflicting with this enchantment
-
EnchantmentMock
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:
displayNamein classorg.bukkit.enchantments.Enchantment
-
isTradeable
public boolean isTradeable()- Specified by:
isTradeablein classorg.bukkit.enchantments.Enchantment
-
isDiscoverable
public boolean isDiscoverable()- Specified by:
isDiscoverablein classorg.bukkit.enchantments.Enchantment
-
getMaxModifiedCost
public int getMaxModifiedCost(int level) - Specified by:
getMaxModifiedCostin classorg.bukkit.enchantments.Enchantment
-
getAnvilCost
public int getAnvilCost()- Specified by:
getAnvilCostin classorg.bukkit.enchantments.Enchantment
-
getMinModifiedCost
public int getMinModifiedCost(int level) - Specified by:
getMinModifiedCostin classorg.bukkit.enchantments.Enchantment
-
getRarity
@NotNull public @NotNull io.papermc.paper.enchantments.EnchantmentRarity getRarity()- Specified by:
getRarityin classorg.bukkit.enchantments.Enchantment
-
getDamageIncrease
public float getDamageIncrease(int level, @NotNull @NotNull org.bukkit.entity.EntityCategory entityCategory) - Specified by:
getDamageIncreasein classorg.bukkit.enchantments.Enchantment
-
getDamageIncrease
public float getDamageIncrease(int level, @NotNull @NotNull org.bukkit.entity.EntityType entityType) - Specified by:
getDamageIncreasein classorg.bukkit.enchantments.Enchantment
-
getActiveSlots
- Specified by:
getActiveSlotsin classorg.bukkit.enchantments.Enchantment
-
translationKey
-
getName
- Specified by:
getNamein classorg.bukkit.enchantments.Enchantment
-
getMaxLevel
public int getMaxLevel()- Specified by:
getMaxLevelin classorg.bukkit.enchantments.Enchantment
-
setMaxLevel
public void setMaxLevel(int maxLevel) Sets the return value ofgetMaxLevel().- Parameters:
maxLevel- The max level.- See Also:
-
getStartLevel
public int getStartLevel()- Specified by:
getStartLevelin classorg.bukkit.enchantments.Enchantment
-
setStartLevel
public void setStartLevel(int startLevel) Sets the return value ofgetStartLevel().- 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:
getItemTargetin classorg.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 ofgetItemTarget().- Parameters:
itemTarget- The item target.- See Also:
-
isTreasure
public boolean isTreasure()- Specified by:
isTreasurein classorg.bukkit.enchantments.Enchantment
-
setTreasure
public void setTreasure(boolean isTreasure) Sets the return value ofisTreasure().- Parameters:
isTreasure- Whether the enchantment is treasure.- See Also:
-
isCursed
public boolean isCursed()- Specified by:
isCursedin classorg.bukkit.enchantments.Enchantment
-
setCursed
public void setCursed(boolean isCursed) Sets the return value ofisCursed().- Parameters:
isCursed- Whether the enchantment is cursed.- See Also:
-
conflictsWith
public boolean conflictsWith(@NotNull @NotNull org.bukkit.enchantments.Enchantment other) - Specified by:
conflictsWithin classorg.bukkit.enchantments.Enchantment
-
canEnchantItem
public boolean canEnchantItem(@NotNull @NotNull org.bukkit.inventory.ItemStack item) - Specified by:
canEnchantItemin classorg.bukkit.enchantments.Enchantment
-
getKey
@NotNull public @NotNull org.bukkit.NamespacedKey getKey() -
getTranslationKey
-
from
-
EnchantmentMock(NamespacedKey, boolean, boolean, int, int, String, Component[], int[], int[], boolean, boolean, Set)instead.