Package com.cryptomorin.xseries
Enum XEnchantment
- java.lang.Object
-
- java.lang.Enum<XEnchantment>
-
- com.cryptomorin.xseries.XEnchantment
-
- All Implemented Interfaces:
Serializable,Comparable<XEnchantment>
public enum XEnchantment extends Enum<XEnchantment>
Enchantment support with multiple aliases. Uses EssentialsX enchantment list for aliases. Enchantment levels do not start from 0, they start from 1EssentialsX 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.gamepedia.com/Enchanting
- Version:
- 2.1.1
- Author:
- Crypto Morin
- See Also:
Enchantment
-
-
Enum Constant Summary
-
Field Summary
Fields Modifier and Type Field Description static Set<org.bukkit.entity.EntityType>EFFECTIVE_BANE_OF_ARTHROPODS_ENTITIESEntity types thatDAMAGE_ARTHROPODSenchantment is effective against.static Set<org.bukkit.entity.EntityType>EFFECTIVE_SMITE_ENTITIESEntity types thatDAMAGE_UNDEADenchantment is effective against.static XEnchantment[]VALUESCached list ofvalues()to avoid allocating memory for
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static org.bukkit.inventory.ItemStackaddEnchantFromString(org.bukkit.inventory.ItemStack item, String enchantment)Adds an unsafe enchantment to the given item from a string.org.bukkit.inventory.ItemStackgetBook(int level)Gets the enchanted book of this enchantment.static booleanisArthropodsEffectiveAgainst(org.bukkit.entity.EntityType type)Checks ifBane of Arthropodsis effective against this type of mob.static booleanisSmiteEffectiveAgainst(org.bukkit.entity.EntityType type)Checks ifSmiteis effective against this type of mob.booleanisSupported()Checks if this enchantment is supported and registered in the current Minecraft version.static Optional<XEnchantment>matchXEnchantment(String enchantment)Gets an enchantment from Vanilla and bukkit names.static XEnchantmentmatchXEnchantment(org.bukkit.enchantments.Enchantment enchantment)Gets an enchantment from Vanilla and bukkit names.org.bukkit.enchantments.EnchantmentparseEnchantment()Parse the Vanilla enchantment.StringtoString()In most cases your should be usingEnum.name()instead.static XEnchantmentvalueOf(String name)Returns 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 Detail
-
ARROW_DAMAGE
public static final XEnchantment ARROW_DAMAGE
-
ARROW_FIRE
public static final XEnchantment ARROW_FIRE
-
ARROW_INFINITE
public static final XEnchantment ARROW_INFINITE
-
ARROW_KNOCKBACK
public static final XEnchantment ARROW_KNOCKBACK
-
BINDING_CURSE
public static final XEnchantment BINDING_CURSE
-
CHANNELING
public static final XEnchantment CHANNELING
-
DAMAGE_ALL
public static final XEnchantment DAMAGE_ALL
-
DAMAGE_ARTHROPODS
public static final XEnchantment DAMAGE_ARTHROPODS
-
DAMAGE_UNDEAD
public static final XEnchantment DAMAGE_UNDEAD
-
DEPTH_STRIDER
public static final XEnchantment DEPTH_STRIDER
-
DIG_SPEED
public static final XEnchantment DIG_SPEED
-
DURABILITY
public static final XEnchantment DURABILITY
-
FIRE_ASPECT
public static final XEnchantment FIRE_ASPECT
-
FROST_WALKER
public static final XEnchantment FROST_WALKER
-
IMPALING
public static final XEnchantment IMPALING
-
SOUL_SPEED
public static final XEnchantment SOUL_SPEED
-
KNOCKBACK
public static final XEnchantment KNOCKBACK
-
LOOT_BONUS_BLOCKS
public static final XEnchantment LOOT_BONUS_BLOCKS
-
LOOT_BONUS_MOBS
public static final XEnchantment LOOT_BONUS_MOBS
-
LOYALTY
public static final XEnchantment LOYALTY
-
LUCK
public static final XEnchantment LUCK
-
LURE
public static final XEnchantment LURE
-
MENDING
public static final XEnchantment MENDING
-
MULTISHOT
public static final XEnchantment MULTISHOT
-
OXYGEN
public static final XEnchantment OXYGEN
-
PIERCING
public static final XEnchantment PIERCING
-
PROTECTION_ENVIRONMENTAL
public static final XEnchantment PROTECTION_ENVIRONMENTAL
-
PROTECTION_EXPLOSIONS
public static final XEnchantment PROTECTION_EXPLOSIONS
-
PROTECTION_FALL
public static final XEnchantment PROTECTION_FALL
-
PROTECTION_FIRE
public static final XEnchantment PROTECTION_FIRE
-
PROTECTION_PROJECTILE
public static final XEnchantment PROTECTION_PROJECTILE
-
QUICK_CHARGE
public static final XEnchantment QUICK_CHARGE
-
RIPTIDE
public static final XEnchantment RIPTIDE
-
SILK_TOUCH
public static final XEnchantment SILK_TOUCH
-
SWEEPING_EDGE
public static final XEnchantment SWEEPING_EDGE
-
THORNS
public static final XEnchantment THORNS
-
VANISHING_CURSE
public static final XEnchantment VANISHING_CURSE
-
WATER_WORKER
public static final XEnchantment WATER_WORKER
-
-
Field Detail
-
VALUES
public static final XEnchantment[] VALUES
Cached list ofvalues()to avoid allocating memory for- Since:
- 1.0.0
-
EFFECTIVE_SMITE_ENTITIES
public static final Set<org.bukkit.entity.EntityType> EFFECTIVE_SMITE_ENTITIES
Entity types thatDAMAGE_UNDEADenchantment is effective against. This set is unmodifiable.- Since:
- 1.2.0
-
EFFECTIVE_BANE_OF_ARTHROPODS_ENTITIES
public static final Set<org.bukkit.entity.EntityType> EFFECTIVE_BANE_OF_ARTHROPODS_ENTITIES
Entity types thatDAMAGE_ARTHROPODSenchantment is effective against. This set is unmodifiable.- Since:
- 1.2.0
-
-
Method Detail
-
values
public static XEnchantment[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (XEnchantment c : XEnchantment.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static XEnchantment valueOf(String name)
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 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 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
@Nonnull public static Optional<XEnchantment> matchXEnchantment(@Nonnull 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
@Nonnull public static XEnchantment matchXEnchantment(@Nonnull 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 unexpeceted exception.- Since:
- 1.0.0
-
addEnchantFromString
@Nonnull public static org.bukkit.inventory.ItemStack addEnchantFromString(@Nonnull org.bukkit.inventory.ItemStack item, @Nullable String enchantment)
Adds an unsafe enchantment to the given item from a string.ItemStack item = ...; addEnchantFromString(item, "unbreaking, 10"); addEnchantFromString(item, "mending");Note that if you set your item's meta
ItemStack.setItemMeta(ItemMeta)the enchantment will be removed. You need to useItemMeta.addEnchant(Enchantment, int, boolean)instead. You can use thematchXEnchantment(String)method in this case.- Parameters:
item- the item to add the enchantment to.enchantment- the enchantment string containing the enchantment name and level (optional)- Returns:
- an enchanted
ItemStackor the item itself without enchantment added if enchantment type is null. - Since:
- 1.0.0
- See Also:
matchXEnchantment(String)
-
getBook
@Nonnull public 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
-
parseEnchantment
@Nullable public org.bukkit.enchantments.Enchantment parseEnchantment()
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:
parseEnchantment()!= null- Returns:
- true if the current version has this enchantment, otherwise false.
- Since:
- 1.0.0
-
toString
@Nonnull public String toString()
In most cases your should be usingEnum.name()instead.- Overrides:
toStringin classEnum<XEnchantment>- Returns:
- a friendly readable string name.
-
-