org.bukkit.enchantments
Class Enchantment

java.lang.Object
  extended by org.bukkit.enchantments.Enchantment
Direct Known Subclasses:
EnchantmentWrapper

public abstract class Enchantment
extends Object

The various type of enchantments that may be added to armour or weapons


Field Summary
static Enchantment ARROW_DAMAGE
          Provides extra damage when shooting arrows from bows
static Enchantment ARROW_FIRE
          Sets entities on fire when hit by arrows shot from a bow
static Enchantment ARROW_INFINITE
          Provides infinite arrows when shooting a bow
static Enchantment ARROW_KNOCKBACK
          Provides a knockback when an entity is hit by an arrow from a bow
static Enchantment DAMAGE_ALL
          Increases damage against all targets
static Enchantment DAMAGE_ARTHROPODS
          Increases damage against arthropod targets
static Enchantment DAMAGE_UNDEAD
          Increases damage against undead targets
static Enchantment DIG_SPEED
          Increases the rate at which you mine/dig
static Enchantment DURABILITY
          Decreases the rate at which a tool looses durability
static Enchantment FIRE_ASPECT
          When attacking a target, has a chance to set them on fire
static Enchantment KNOCKBACK
          All damage to other targets will knock them back when hit
static Enchantment LOOT_BONUS_BLOCKS
          Provides a chance of gaining extra loot when destroying blocks
static Enchantment LOOT_BONUS_MOBS
          Provides a chance of gaining extra loot when killing monsters
static Enchantment OXYGEN
          Decreases the rate of air loss whilst underwater
static Enchantment PROTECTION_ENVIRONMENTAL
          Provides protection against environmental damage
static Enchantment PROTECTION_EXPLOSIONS
          Provides protection against explosive damage
static Enchantment PROTECTION_FALL
          Provides protection against fall damage
static Enchantment PROTECTION_FIRE
          Provides protection against fire damage
static Enchantment PROTECTION_PROJECTILE
          Provides protection against projectile damage
static Enchantment SILK_TOUCH
          Allows blocks to drop themselves instead of fragments (for example, stone instead of cobblestone)
static Enchantment THORNS
          Damages the attacker
static Enchantment WATER_WORKER
          Increases the speed at which a player may mine underwater
 
Constructor Summary
Enchantment(int id)
           
 
Method Summary
abstract  boolean canEnchantItem(ItemStack item)
          Checks if this Enchantment may be applied to the given ItemStack.
abstract  boolean conflictsWith(Enchantment other)
          Check if this enchantment conflicts with another enchantment.
 boolean equals(Object obj)
           
static Enchantment getById(int id)
          Deprecated. Magic value
static Enchantment getByName(String name)
          Gets the Enchantment at the specified name
 int getId()
          Deprecated. Magic value
abstract  EnchantmentTarget getItemTarget()
          Gets the type of ItemStack that may fit this Enchantment.
abstract  int getMaxLevel()
          Gets the maximum level that this Enchantment may become.
abstract  String getName()
          Gets the unique name of this enchantment
abstract  int getStartLevel()
          Gets the level that this Enchantment should start at
 int hashCode()
           
static boolean isAcceptingRegistrations()
          Checks if this is accepting Enchantment registrations.
static void registerEnchantment(Enchantment enchantment)
          Registers an enchantment with the given ID and object.
static void stopAcceptingRegistrations()
          Stops accepting any enchantment registrations
 String toString()
           
static Enchantment[] values()
          Gets an array of all the registered Enchantments
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PROTECTION_ENVIRONMENTAL

public static final Enchantment PROTECTION_ENVIRONMENTAL
Provides protection against environmental damage


PROTECTION_FIRE

public static final Enchantment PROTECTION_FIRE
Provides protection against fire damage


PROTECTION_FALL

public static final Enchantment PROTECTION_FALL
Provides protection against fall damage


PROTECTION_EXPLOSIONS

public static final Enchantment PROTECTION_EXPLOSIONS
Provides protection against explosive damage


PROTECTION_PROJECTILE

public static final Enchantment PROTECTION_PROJECTILE
Provides protection against projectile damage


OXYGEN

public static final Enchantment OXYGEN
Decreases the rate of air loss whilst underwater


WATER_WORKER

public static final Enchantment WATER_WORKER
Increases the speed at which a player may mine underwater


THORNS

public static final Enchantment THORNS
Damages the attacker


DAMAGE_ALL

public static final Enchantment DAMAGE_ALL
Increases damage against all targets


DAMAGE_UNDEAD

public static final Enchantment DAMAGE_UNDEAD
Increases damage against undead targets


DAMAGE_ARTHROPODS

public static final Enchantment DAMAGE_ARTHROPODS
Increases damage against arthropod targets


KNOCKBACK

public static final Enchantment KNOCKBACK
All damage to other targets will knock them back when hit


FIRE_ASPECT

public static final Enchantment FIRE_ASPECT
When attacking a target, has a chance to set them on fire


LOOT_BONUS_MOBS

public static final Enchantment LOOT_BONUS_MOBS
Provides a chance of gaining extra loot when killing monsters


DIG_SPEED

public static final Enchantment DIG_SPEED
Increases the rate at which you mine/dig


SILK_TOUCH

public static final Enchantment SILK_TOUCH
Allows blocks to drop themselves instead of fragments (for example, stone instead of cobblestone)


DURABILITY

public static final Enchantment DURABILITY
Decreases the rate at which a tool looses durability


LOOT_BONUS_BLOCKS

public static final Enchantment LOOT_BONUS_BLOCKS
Provides a chance of gaining extra loot when destroying blocks


ARROW_DAMAGE

public static final Enchantment ARROW_DAMAGE
Provides extra damage when shooting arrows from bows


ARROW_KNOCKBACK

public static final Enchantment ARROW_KNOCKBACK
Provides a knockback when an entity is hit by an arrow from a bow


ARROW_FIRE

public static final Enchantment ARROW_FIRE
Sets entities on fire when hit by arrows shot from a bow


ARROW_INFINITE

public static final Enchantment ARROW_INFINITE
Provides infinite arrows when shooting a bow

Constructor Detail

Enchantment

public Enchantment(int id)
Method Detail

getId

@Deprecated
public int getId()
Deprecated. Magic value

Gets the unique ID of this enchantment

Returns:
Unique ID

getName

public abstract String getName()
Gets the unique name of this enchantment

Returns:
Unique name

getMaxLevel

public abstract int getMaxLevel()
Gets the maximum level that this Enchantment may become.

Returns:
Maximum level of the Enchantment

getStartLevel

public abstract int getStartLevel()
Gets the level that this Enchantment should start at

Returns:
Starting level of the Enchantment

getItemTarget

public abstract EnchantmentTarget getItemTarget()
Gets the type of ItemStack that may fit this Enchantment.

Returns:
Target type of the Enchantment

conflictsWith

public abstract boolean conflictsWith(Enchantment other)
Check if this enchantment conflicts with another enchantment.

Parameters:
other - The enchantment to check against
Returns:
True if there is a conflict.

canEnchantItem

public abstract boolean canEnchantItem(ItemStack item)
Checks if this Enchantment may be applied to the given ItemStack. This does not check if it conflicts with any enchantments already applied to the item.

Parameters:
item - Item to test
Returns:
True if the enchantment may be applied, otherwise False

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

registerEnchantment

public static void registerEnchantment(Enchantment enchantment)
Registers an enchantment with the given ID and object.

Generally not to be used from within a plugin.

Parameters:
enchantment - Enchantment to register

isAcceptingRegistrations

public static boolean isAcceptingRegistrations()
Checks if this is accepting Enchantment registrations.

Returns:
True if the server Implementation may add enchantments

stopAcceptingRegistrations

public static void stopAcceptingRegistrations()
Stops accepting any enchantment registrations


getById

@Deprecated
public static Enchantment getById(int id)
Deprecated. Magic value

Gets the Enchantment at the specified ID

Parameters:
id - ID to fetch
Returns:
Resulting Enchantment, or null if not found

getByName

public static Enchantment getByName(String name)
Gets the Enchantment at the specified name

Parameters:
name - Name to fetch
Returns:
Resulting Enchantment, or null if not found

values

public static Enchantment[] values()
Gets an array of all the registered Enchantments

Returns:
Array of enchantments


Copyright © 2014. All rights reserved.