Package net.glowstone.constants
Class GlowEnchantment
java.lang.Object
org.bukkit.enchantments.Enchantment
net.glowstone.constants.GlowEnchantment
- All Implemented Interfaces:
WeightedRandom.Choice
,org.bukkit.Keyed
public final class GlowEnchantment
extends org.bukkit.enchantments.Enchantment
implements WeightedRandom.Choice
Definitions of enchantment types.
-
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, THORNS, VANISHING_CURSE, WATER_WORKER
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canEnchantItem
(org.bukkit.inventory.ItemStack item) boolean
canEnchantPrimary
(org.bukkit.inventory.ItemStack item) If this enchantment can be applied to this item using an enchantment table.boolean
canEnchantSecondary
(org.bukkit.inventory.ItemStack item) If this enchantment cannot be applied using an enchantment table but can be applied using an enchanted book and anvil.boolean
conflictsWith
(org.bukkit.enchantments.Enchantment other) @NotNull net.kyori.adventure.text.Component
displayName
(int i) @NotNull Set<org.bukkit.inventory.EquipmentSlot>
static org.bukkit.enchantments.Enchantment
getByVanillaId
(String vanillaId) float
getDamageIncrease
(int i, @NotNull org.bukkit.entity.EntityCategory entityCategory) int
getId()
org.bukkit.enchantments.EnchantmentTarget
int
getName()
io.papermc.paper.enchantments.EnchantmentRarity
Represents the rarity of obtaining an enchantment.int
int
The rarity of the enchantment, kept for compatibility with Bukkit.boolean
isCursed()
boolean
boolean
isInRange
(int level, int modifier) boolean
boolean
Treasure enchantments can only be obtained from chest loot, fishing, or trading for enchanted books.static org.bukkit.enchantments.Enchantment
parseEnchantment
(String enchantmentName) Parses a PotionEffect id or name if possible.static void
register()
Register all enchantment types with Enchantment.Methods inherited from class org.bukkit.enchantments.Enchantment
equals, getByKey, getByName, getKey, hashCode, isAcceptingRegistrations, registerEnchantment, stopAcceptingRegistrations, toString, values
-
Method Details
-
register
public static void register()Register all enchantment types with Enchantment. -
getVanillaIds
-
parseEnchantment
Parses a PotionEffect id or name if possible.- Parameters:
enchantmentName
- The Enchantment name.- Returns:
- The associated Enchantment, or null.
-
getByVanillaId
-
getName
- Specified by:
getName
in classorg.bukkit.enchantments.Enchantment
-
getId
public int getId() -
getMaxLevel
public int getMaxLevel()- Specified by:
getMaxLevel
in classorg.bukkit.enchantments.Enchantment
-
getStartLevel
public int getStartLevel()- Specified by:
getStartLevel
in classorg.bukkit.enchantments.Enchantment
-
getItemTarget
public org.bukkit.enchantments.EnchantmentTarget getItemTarget()- Specified by:
getItemTarget
in classorg.bukkit.enchantments.Enchantment
-
conflictsWith
public boolean conflictsWith(org.bukkit.enchantments.Enchantment other) - Specified by:
conflictsWith
in classorg.bukkit.enchantments.Enchantment
-
canEnchantItem
public boolean canEnchantItem(org.bukkit.inventory.ItemStack item) - Specified by:
canEnchantItem
in classorg.bukkit.enchantments.Enchantment
-
displayName
@NotNull public @NotNull net.kyori.adventure.text.Component displayName(int i) - Specified by:
displayName
in classorg.bukkit.enchantments.Enchantment
-
isTradeable
public boolean isTradeable()- Specified by:
isTradeable
in classorg.bukkit.enchantments.Enchantment
-
isDiscoverable
public boolean isDiscoverable()- Specified by:
isDiscoverable
in classorg.bukkit.enchantments.Enchantment
-
canEnchantPrimary
public boolean canEnchantPrimary(org.bukkit.inventory.ItemStack item) If this enchantment can be applied to this item using an enchantment table.- Returns:
- If this item is a primary item for this enchantment
-
canEnchantSecondary
public boolean canEnchantSecondary(org.bukkit.inventory.ItemStack item) If this enchantment cannot be applied using an enchantment table but can be applied using an enchanted book and anvil.- Returns:
- If this item is a secondary item for this enchantment
-
getWeight
public int getWeight()The rarity of the enchantment, kept for compatibility with Bukkit.- Specified by:
getWeight
in interfaceWeightedRandom.Choice
- See Also:
-
isTreasure
public boolean isTreasure()Treasure enchantments can only be obtained from chest loot, fishing, or trading for enchanted books.- Specified by:
isTreasure
in classorg.bukkit.enchantments.Enchantment
- Returns:
- true if the enchantment is a treasure, otherwise false
-
isCursed
public boolean isCursed()- Specified by:
isCursed
in classorg.bukkit.enchantments.Enchantment
-
getRarity
public io.papermc.paper.enchantments.EnchantmentRarity getRarity()Represents the rarity of obtaining an enchantment.- Specified by:
getRarity
in classorg.bukkit.enchantments.Enchantment
- Returns:
- the rarity of the enchantment
-
getDamageIncrease
public float getDamageIncrease(int i, @NotNull @NotNull org.bukkit.entity.EntityCategory entityCategory) - Specified by:
getDamageIncrease
in classorg.bukkit.enchantments.Enchantment
-
getActiveSlots
- Specified by:
getActiveSlots
in classorg.bukkit.enchantments.Enchantment
-
isInRange
public boolean isInRange(int level, int modifier)
-