Solved getting enchantment name

Discussion in 'Plugin Development' started by aima, Aug 26, 2013.

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

    aima

    Hello i would like to create a check to see if the enchant on the players pick matches any mining or tool based enchants such as silk_touch and loot_bonus_block
    Code:java
    1. Player player = event.getPlayer();
    2. ItemStack tool = player.getItemInHand();
    3.  
    4. if(tool.getType().equals(Material.DIAMOND_PICKAXE)){
    5. //check for enchant type here
    6. }
     
  2. Offline

    Napkin222

    Code:java
    1.  
    2. if (tool.containsEnchantment(Enchantment.DIG_SPEED)){
    3. //Do something
    4. }
    5.  


    READ THE JAVADOC, PEOPLE!
     
Thread Status:
Not open for further replies.

Share This Page