Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.enchantments.Enchantment Class Referenceabstract
Inheritance diagram for org.bukkit.enchantments.Enchantment:
org.bukkit.enchantments.EnchantmentWrapper

Public Member Functions

 Enchantment (int id)
 
int getId ()
 
abstract String getName ()
 
abstract int getMaxLevel ()
 
abstract int getStartLevel ()
 
abstract EnchantmentTarget getItemTarget ()
 
abstract boolean conflictsWith (Enchantment other)
 
abstract boolean canEnchantItem (ItemStack item)
 
boolean equals (Object obj)
 
int hashCode ()
 
String toString ()
 

Static Public Member Functions

static void registerEnchantment (Enchantment enchantment)
 
static boolean isAcceptingRegistrations ()
 
static void stopAcceptingRegistrations ()
 
static Enchantment getById (int id)
 
static Enchantment getByName (String name)
 
static Enchantment[] values ()
 

Static Public Attributes

static final Enchantment PROTECTION_ENVIRONMENTAL = new EnchantmentWrapper(0)
 
static final Enchantment PROTECTION_FIRE = new EnchantmentWrapper(1)
 
static final Enchantment PROTECTION_FALL = new EnchantmentWrapper(2)
 
static final Enchantment PROTECTION_EXPLOSIONS = new EnchantmentWrapper(3)
 
static final Enchantment PROTECTION_PROJECTILE = new EnchantmentWrapper(4)
 
static final Enchantment OXYGEN = new EnchantmentWrapper(5)
 
static final Enchantment WATER_WORKER = new EnchantmentWrapper(6)
 
static final Enchantment THORNS = new EnchantmentWrapper(7)
 
static final Enchantment DAMAGE_ALL = new EnchantmentWrapper(16)
 
static final Enchantment DAMAGE_UNDEAD = new EnchantmentWrapper(17)
 
static final Enchantment DAMAGE_ARTHROPODS = new EnchantmentWrapper(18)
 
static final Enchantment KNOCKBACK = new EnchantmentWrapper(19)
 
static final Enchantment FIRE_ASPECT = new EnchantmentWrapper(20)
 
static final Enchantment LOOT_BONUS_MOBS = new EnchantmentWrapper(21)
 
static final Enchantment DIG_SPEED = new EnchantmentWrapper(32)
 
static final Enchantment SILK_TOUCH = new EnchantmentWrapper(33)
 
static final Enchantment DURABILITY = new EnchantmentWrapper(34)
 
static final Enchantment LOOT_BONUS_BLOCKS = new EnchantmentWrapper(35)
 
static final Enchantment ARROW_DAMAGE = new EnchantmentWrapper(48)
 
static final Enchantment ARROW_KNOCKBACK = new EnchantmentWrapper(49)
 
static final Enchantment ARROW_FIRE = new EnchantmentWrapper(50)
 
static final Enchantment ARROW_INFINITE = new EnchantmentWrapper(51)
 
static final Enchantment LUCK = new EnchantmentWrapper(61)
 
static final Enchantment LURE = new EnchantmentWrapper(62)
 

Detailed Description

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

Definition at line 12 of file Enchantment.java.

Member Function Documentation

abstract boolean org.bukkit.enchantments.Enchantment.canEnchantItem ( ItemStack  item)
abstract

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
itemItem to test
Returns
True if the enchantment may be applied, otherwise False

Referenced by org.bukkit.inventory.ItemStack.addEnchantment().

abstract boolean org.bukkit.enchantments.Enchantment.conflictsWith ( Enchantment  other)
abstract

Check if this enchantment conflicts with another enchantment.

Parameters
otherThe enchantment to check against
Returns
True if there is a conflict.
static Enchantment org.bukkit.enchantments.Enchantment.getById ( int  id)
static

Gets the Enchantment at the specified ID

Parameters
idID to fetch
Returns
Resulting Enchantment, or null if not found
Deprecated:
Magic value

Definition at line 270 of file Enchantment.java.

Referenced by org.bukkit.enchantments.EnchantmentWrapper.getEnchantment().

270  {
271  return byId.get(id);
272  }
static Enchantment org.bukkit.enchantments.Enchantment.getByName ( String  name)
static

Gets the Enchantment at the specified name

Parameters
nameName to fetch
Returns
Resulting Enchantment, or null if not found

Definition at line 280 of file Enchantment.java.

Referenced by org.bukkit.inventory.ItemStack.deserialize().

280  {
281  return byName.get(name);
282  }
int org.bukkit.enchantments.Enchantment.getId ( )

Gets the unique ID of this enchantment

Returns
Unique ID
Deprecated:
Magic value

Definition at line 150 of file Enchantment.java.

Referenced by org.bukkit.enchantments.EnchantmentWrapper.getEnchantment().

150  {
151  return id;
152  }
abstract EnchantmentTarget org.bukkit.enchantments.Enchantment.getItemTarget ( )
abstract

Gets the type of ItemStack that may fit this Enchantment.

Returns
Target type of the Enchantment
abstract int org.bukkit.enchantments.Enchantment.getMaxLevel ( )
abstract

Gets the maximum level that this Enchantment may become.

Returns
Maximum level of the Enchantment

Referenced by org.bukkit.inventory.ItemStack.addEnchantment().

abstract String org.bukkit.enchantments.Enchantment.getName ( )
abstract

Gets the unique name of this enchantment

Returns
Unique name

Referenced by org.bukkit.enchantments.Enchantment.registerEnchantment().

abstract int org.bukkit.enchantments.Enchantment.getStartLevel ( )
abstract

Gets the level that this Enchantment should start at

Returns
Starting level of the Enchantment

Referenced by org.bukkit.inventory.ItemStack.addEnchantment().

static boolean org.bukkit.enchantments.Enchantment.isAcceptingRegistrations ( )
static

Checks if this is accepting Enchantment registrations.

Returns
True if the server Implementation may add enchantments

Definition at line 250 of file Enchantment.java.

Referenced by org.bukkit.enchantments.Enchantment.registerEnchantment().

250  {
251  return acceptingNew;
252  }
static void org.bukkit.enchantments.Enchantment.registerEnchantment ( Enchantment  enchantment)
static

Registers an enchantment with the given ID and object.

Generally not to be used from within a plugin.

Parameters
enchantmentEnchantment to register

Definition at line 234 of file Enchantment.java.

References org.bukkit.enchantments.Enchantment.getName(), and org.bukkit.enchantments.Enchantment.isAcceptingRegistrations().

234  {
235  if (byId.containsKey(enchantment.id) || byName.containsKey(enchantment.getName())) {
236  throw new IllegalArgumentException("Cannot set already-set enchantment");
237  } else if (!isAcceptingRegistrations()) {
238  throw new IllegalStateException("No longer accepting new enchantments (can only be done by the server implementation)");
239  }
240 
241  byId.put(enchantment.id, enchantment);
242  byName.put(enchantment.getName(), enchantment);
243  }
static void org.bukkit.enchantments.Enchantment.stopAcceptingRegistrations ( )
static

Stops accepting any enchantment registrations

Definition at line 257 of file Enchantment.java.

257  {
258  acceptingNew = false;
259  EnchantCommand.buildEnchantments();
260  }
static Enchantment [] org.bukkit.enchantments.Enchantment.values ( )
static

Gets an array of all the registered Enchantments

Returns
Array of enchantments

Definition at line 289 of file Enchantment.java.

References org.bukkit.enchantments.Enchantment.values().

Referenced by org.bukkit.enchantments.Enchantment.values().

289  {
290  return byId.values().toArray(new Enchantment[byId.size()]);
291  }

Member Data Documentation

final Enchantment org.bukkit.enchantments.Enchantment.ARROW_DAMAGE = new EnchantmentWrapper(48)
static

Provides extra damage when shooting arrows from bows

Definition at line 107 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.ARROW_FIRE = new EnchantmentWrapper(50)
static

Sets entities on fire when hit by arrows shot from a bow

Definition at line 117 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.ARROW_INFINITE = new EnchantmentWrapper(51)
static

Provides infinite arrows when shooting a bow

Definition at line 122 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.ARROW_KNOCKBACK = new EnchantmentWrapper(49)
static

Provides a knockback when an entity is hit by an arrow from a bow

Definition at line 112 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.DAMAGE_ALL = new EnchantmentWrapper(16)
static

Increases damage against all targets

Definition at line 56 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.DAMAGE_ARTHROPODS = new EnchantmentWrapper(18)
static

Increases damage against arthropod targets

Definition at line 66 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.DAMAGE_UNDEAD = new EnchantmentWrapper(17)
static

Increases damage against undead targets

Definition at line 61 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.DIG_SPEED = new EnchantmentWrapper(32)
static

Increases the rate at which you mine/dig

Definition at line 86 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.DURABILITY = new EnchantmentWrapper(34)
static

Decreases the rate at which a tool looses durability

Definition at line 97 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.FIRE_ASPECT = new EnchantmentWrapper(20)
static

When attacking a target, has a chance to set them on fire

Definition at line 76 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.KNOCKBACK = new EnchantmentWrapper(19)
static

All damage to other targets will knock them back when hit

Definition at line 71 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.LOOT_BONUS_BLOCKS = new EnchantmentWrapper(35)
static

Provides a chance of gaining extra loot when destroying blocks

Definition at line 102 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.LOOT_BONUS_MOBS = new EnchantmentWrapper(21)
static

Provides a chance of gaining extra loot when killing monsters

Definition at line 81 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.LUCK = new EnchantmentWrapper(61)
static

Decreases odds of catching worthless junk

Definition at line 127 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.LURE = new EnchantmentWrapper(62)
static

Increases rate of fish biting your hook

Definition at line 132 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.OXYGEN = new EnchantmentWrapper(5)
static

Decreases the rate of air loss whilst underwater

Definition at line 41 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.PROTECTION_ENVIRONMENTAL = new EnchantmentWrapper(0)
static

Provides protection against environmental damage

Definition at line 16 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.PROTECTION_EXPLOSIONS = new EnchantmentWrapper(3)
static

Provides protection against explosive damage

Definition at line 31 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.PROTECTION_FALL = new EnchantmentWrapper(2)
static

Provides protection against fall damage

Definition at line 26 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.PROTECTION_FIRE = new EnchantmentWrapper(1)
static

Provides protection against fire damage

Definition at line 21 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.PROTECTION_PROJECTILE = new EnchantmentWrapper(4)
static

Provides protection against projectile damage

Definition at line 36 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.SILK_TOUCH = new EnchantmentWrapper(33)
static

Allows blocks to drop themselves instead of fragments (for example, stone instead of cobblestone)

Definition at line 92 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.THORNS = new EnchantmentWrapper(7)
static

Damages the attacker

Definition at line 51 of file Enchantment.java.

final Enchantment org.bukkit.enchantments.Enchantment.WATER_WORKER = new EnchantmentWrapper(6)
static

Increases the speed at which a player may mine underwater

Definition at line 46 of file Enchantment.java.


The documentation for this class was generated from the following file: