Solved Checking Enchantment Level of Item in Hand

Discussion in 'Plugin Development' started by Compressions, Apr 10, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Compressions

    I need to see if the item in hand of a player is a diamond sword with Sharpness II on it. In the past, I have been able to check if it has just an enchantment through this:
    Code:java
    1. if(sword.containsEnchantment(Enchantment.DAMAGE_ALL)) {

    Now, I want to check the enchantment level, such as level 2. Is there any way to achieve this (hopefully avoiding hashmaps and similar methods)?
    Thanks! :)
     
  2. Offline

    Bloxcraft

    Code:
    sword.getEnchantmentLevel(Enchantment.DAMAGE_ALL) == 2
    
     
    spideynn and Compressions like this.
  3. Offline

    Compressions

Thread Status:
Not open for further replies.

Share This Page