Getting Skull Type

Discussion in 'Plugin Development' started by MrlolDestructo, Jul 23, 2013.

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

    MrlolDestructo

    Hey,
    I've just run into a roadblock, don't know how to fix it. How would I check if the item in the player's hand is a wither skull head? Here's what I mean:
    Code:java
    1. @EventHandler
    2. public void onPlayerInteract(PlayerInteractEvent event) {
    3. Player player = event.getPlayer();
    4. if(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
    5. if(player.getItemInHand().getType() == /**Wither Skull Head*/) {
    6. //Code here
    7. }
    8. }
    9. }

    Thanks
    ~ MrlolDestructo
     
  2. Offline

    chasechocolate

    I believe the item ID is 397, but you will also need to check the data (item.getData().getData() == 1).
     
  3. Offline

    TheTinySpider

    Check the item durability to match the wither data value (link).
    Please search the forums before you ask something, because stuff like this is asked many times before you.
     
  4. Offline

    MrlolDestructo

    Thanks guys. :)
    And TheTinySpider , I have checked the forums, I always check before creating a post. The thing was, none of them really answered the question, or I was still confused, so I asked here. Thanks ;)
     
Thread Status:
Not open for further replies.

Share This Page