Package com.cryptomorin.xseries
Enum XEnchantment
- All Implemented Interfaces:
Serializable,Comparable<XEnchantment>
Enchantment support with multiple aliases.
Uses EssentialsX enchantment list for aliases.
Enchantment levels do not start from 0, they start from 1
EssentialsX Enchantment: https://github.com/Bukkit/Bukkit/blob/master/src/main/java/org/bukkit/enchantments/Enchantment.java Enchantment: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/enchantments/Enchantment.html Enchanting: https://minecraft.wiki/w/Enchanting
- Version:
- 3.0.0
- Author:
- Crypto Morin
- See Also:
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Set<org.bukkit.entity.EntityType> Entity types thatBANE_OF_ARTHROPODSenchantment is effective against.static final Set<org.bukkit.entity.EntityType> Entity types thatSMITEenchantment is effective against.static final XEnchantment[]Cached list ofvalues()to avoid allocating memory for -
Method Summary
Modifier and TypeMethodDescription@NotNull org.bukkit.inventory.ItemStackgetBook(int level) Gets the enchanted book of this enchantment.@Nullable org.bukkit.enchantments.EnchantmentParse the Vanilla enchantment.static booleanisArthropodsEffectiveAgainst(@Nullable org.bukkit.entity.EntityType type) Checks ifBane of Arthropodsis effective against this type of mob.static booleanisSmiteEffectiveAgainst(@Nullable org.bukkit.entity.EntityType type) Checks ifSmiteis effective against this type of mob.booleanChecks if this enchantment is supported and registered in the current Minecraft version.static @NotNull Optional<XEnchantment> matchXEnchantment(@NotNull String enchantment) Gets an enchantment from Vanilla and bukkit names.static @NotNull XEnchantmentmatchXEnchantment(@NotNull org.bukkit.enchantments.Enchantment enchantment) Gets an enchantment from Vanilla and bukkit names.@Nullable XEnchantmentor(@Nullable XEnchantment alternateEnchantment) Checks if this enchantment is supported in the current version and returns itself if yes.@NotNull StringtoString()In most cases you should be usingEnum.name()instead.static XEnchantmentReturns the enum constant of this type with the specified name.static XEnchantment[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
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
-
-
Field Details
-
VALUES
Cached list ofvalues()to avoid allocating memory for- Since:
- 1.0.0
-
EFFECTIVE_SMITE_ENTITIES
Entity types thatSMITEenchantment is effective against. This set is unmodifiable.- Since:
- 1.2.0
-
EFFECTIVE_BANE_OF_ARTHROPODS_ENTITIES
Entity types thatBANE_OF_ARTHROPODSenchantment is effective against. This set is unmodifiable.- Since:
- 1.2.0
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
isSmiteEffectiveAgainst
public static boolean isSmiteEffectiveAgainst(@Nullable @Nullable org.bukkit.entity.EntityType type) Checks ifSmiteis effective against this type of mob.- Parameters:
type- the type of the mob.- Returns:
- true if smite enchantment is effective against the mob, otherwise false.
- Since:
- 1.1.0
-
isArthropodsEffectiveAgainst
public static boolean isArthropodsEffectiveAgainst(@Nullable @Nullable org.bukkit.entity.EntityType type) Checks ifBane of Arthropodsis effective against this type of mob.- Parameters:
type- the type of the mob.- Returns:
- true if Bane of Arthropods enchantment is effective against the mob, otherwise false.
- Since:
- 1.1.0
-
matchXEnchantment
@NotNull public static @NotNull Optional<XEnchantment> matchXEnchantment(@NotNull @NotNull String enchantment) Gets an enchantment from Vanilla and bukkit names. There are also some aliases available.- Parameters:
enchantment- the name of the enchantment.- Returns:
- an enchantment.
- Since:
- 1.0.0
-
matchXEnchantment
@NotNull public static @NotNull XEnchantment matchXEnchantment(@NotNull @NotNull org.bukkit.enchantments.Enchantment enchantment) Gets an enchantment from Vanilla and bukkit names. There are also some aliases available.- Parameters:
enchantment- the enchantment.- Returns:
- an enchantment.
- Throws:
IllegalArgumentException- may be thrown as an unexpected exception.- Since:
- 1.0.0
-
getBook
@NotNull public @NotNull org.bukkit.inventory.ItemStack getBook(int level) Gets the enchanted book of this enchantment.- Parameters:
level- the level of this enchantment.- Returns:
- an enchanted book.
- Since:
- 1.0.0
-
getEnchant
@Nullable public @Nullable org.bukkit.enchantments.Enchantment getEnchant()Parse the Vanilla enchantment.- Returns:
- a Vanilla enchantment.
- Since:
- 1.0.0
-
isSupported
public boolean isSupported()Checks if this enchantment is supported and registered in the current Minecraft version.An invocation of this method yields exactly the same result as the expression:
getEnchant()!= null- Returns:
- true if the current version has this enchantment, otherwise false.
- Since:
- 1.0.0
-
or
Checks if this enchantment is supported in the current version and returns itself if yes.In the other case, the alternate enchantment will get returned, no matter if it is supported or not.
- Parameters:
alternateEnchantment- the enchantment to get if this one is not supported.- Returns:
- this enchantment or the
alternateEnchantmentif not supported.
-
toString
In most cases you should be usingEnum.name()instead.- Overrides:
toStringin classEnum<XEnchantment>- Returns:
- a friendly readable string name.
-