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
,Keyed
,Translatable
Mock implementation of an
Enchantment
.-
Field Summary
Fields inherited from class org.bukkit.enchantments.Enchantment
ARROW_DAMAGE, ARROW_FIRE, ARROW_INFINITE, ARROW_KNOCKBACK, BINDING_CURSE, CHANNELING, DAMAGE_ALL, DAMAGE_ARTHROPODS, DAMAGE_UNDEAD, DEPTH_STRIDER, DIG_SPEED, DURABILITY, FIRE_ASPECT, FROST_WALKER, IMPALING, KNOCKBACK, LOOT_BONUS_BLOCKS, LOOT_BONUS_MOBS, LOYALTY, LUCK, LURE, MENDING, MULTISHOT, OXYGEN, PIERCING, PROTECTION_ENVIRONMENTAL, PROTECTION_EXPLOSIONS, PROTECTION_FALL, PROTECTION_FIRE, PROTECTION_PROJECTILE, QUICK_CHARGE, RIPTIDE, SILK_TOUCH, SOUL_SPEED, SWEEPING_EDGE, SWIFT_SNEAK, THORNS, VANISHING_CURSE, WATER_WORKER
-
Constructor Summary
ConstructorDescriptionEnchantmentMock
(com.google.gson.JsonObject data) Deprecated, for removal: This API element is subject to removal in a future version.EnchantmentMock
(NamespacedKey key, EnchantmentTarget target, boolean treasure, boolean cursed, int maxLevel, int startLevel, String name, net.kyori.adventure.text.Component[] displayNames, int[] minModifiedCost, int[] maxModifiedCost, boolean tradeable, boolean discoverable, EnchantmentRarity rarity, Set<NamespacedKey> conflicts) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canEnchantItem
(@NotNull ItemStack item) boolean
conflictsWith
(@NotNull Enchantment other) @NotNull net.kyori.adventure.text.Component
displayName
(int level) static EnchantmentMock
from
(com.google.gson.JsonObject data) @NotNull Set<EquipmentSlot>
float
getDamageIncrease
(int level, @NotNull EntityCategory entityCategory) @NotNull EnchantmentTarget
@NotNull NamespacedKey
getKey()
int
int
getMaxModifiedCost
(int level) int
getMinModifiedCost
(int level) @NotNull String
getName()
@NotNull EnchantmentRarity
int
@NotNull String
boolean
isCursed()
boolean
boolean
boolean
void
setCursed
(boolean isCursed) Sets the return value ofisCursed()
.void
setItemTarget
(@NotNull EnchantmentTarget itemTarget) Sets the return value ofgetItemTarget()
.void
setMaxLevel
(int maxLevel) Sets the return value ofgetMaxLevel()
.void
setStartLevel
(int startLevel) Sets the return value ofgetStartLevel()
.void
setTreasure
(boolean isTreasure) Sets the return value ofisTreasure()
.@NotNull String
Methods inherited from class org.bukkit.enchantments.Enchantment
getByKey, getByName, values
-
Constructor Details
-
EnchantmentMock
public EnchantmentMock(NamespacedKey key, EnchantmentTarget target, boolean treasure, boolean cursed, int maxLevel, int startLevel, String name, net.kyori.adventure.text.Component[] displayNames, int[] minModifiedCost, int[] maxModifiedCost, boolean tradeable, boolean discoverable, EnchantmentRarity rarity, Set<NamespacedKey> conflicts) - Parameters:
key
- The key representing this enchantmenttarget
- the item targets of 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 tablerarity
- The rarity of this enchantmentconflicts
- 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:
displayName
in classEnchantment
-
isTradeable
public boolean isTradeable()- Specified by:
isTradeable
in classEnchantment
-
isDiscoverable
public boolean isDiscoverable()- Specified by:
isDiscoverable
in classEnchantment
-
getMaxModifiedCost
public int getMaxModifiedCost(int level) - Specified by:
getMaxModifiedCost
in classEnchantment
-
getMinModifiedCost
public int getMinModifiedCost(int level) - Specified by:
getMinModifiedCost
in classEnchantment
-
getRarity
- Specified by:
getRarity
in classEnchantment
-
getDamageIncrease
- Specified by:
getDamageIncrease
in classEnchantment
-
getActiveSlots
- Specified by:
getActiveSlots
in classEnchantment
-
translationKey
-
getName
- Specified by:
getName
in classEnchantment
-
getMaxLevel
public int getMaxLevel()- Specified by:
getMaxLevel
in classEnchantment
-
setMaxLevel
public void setMaxLevel(int maxLevel) Sets the return value ofgetMaxLevel()
.- Parameters:
maxLevel
- The max level.- See Also:
-
getStartLevel
public int getStartLevel()- Specified by:
getStartLevel
in classEnchantment
-
setStartLevel
public void setStartLevel(int startLevel) Sets the return value ofgetStartLevel()
.- Parameters:
startLevel
- The start level.- See Also:
-
getItemTarget
- Specified by:
getItemTarget
in classEnchantment
-
setItemTarget
Sets the return value ofgetItemTarget()
.- Parameters:
itemTarget
- The item target.- See Also:
-
isTreasure
public boolean isTreasure()- Specified by:
isTreasure
in classEnchantment
-
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:
isCursed
in classEnchantment
-
setCursed
public void setCursed(boolean isCursed) Sets the return value ofisCursed()
.- Parameters:
isCursed
- Whether the enchantment is cursed.- See Also:
-
conflictsWith
- Specified by:
conflictsWith
in classEnchantment
-
canEnchantItem
- Specified by:
canEnchantItem
in classEnchantment
-
getKey
-
getTranslationKey
-
from
-
EnchantmentMock(NamespacedKey, EnchantmentTarget, boolean, boolean, int, int, String, Component[], int[], int[], boolean, boolean, EnchantmentRarity, Set)
instead.