ItemHandHeld event?

Discussion in 'Plugin Development' started by Saturisk, Mar 4, 2011.

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

    Saturisk

    Is there a way to see if someones item that there holding is equal to an item?

    Like:
    if (player.isOp() && player.ItemHandHeld == material.getMaterial(GOLD_SPADE);

    I know that doesn't work at all, i'm just trying to get the item to be the gold spade to make this plugin work.

    Also with that, i would like when it's activated the durability doesn't go down would that be like:
    getMaxDurability or something?
     
  2. Offline

    PopeUrban

    I'm not sure the exact circumstances you're checking it in, but I do that in the Altitude plugin I'm working on like so:

    Code:
    //If using a water bucket (326)
            if (event.getPlayer().getItemInHand().getTypeId() == 326){
    //Do stuff
    }
    
     
  3. Offline

    Saturisk

    Ooh okay, well do you have anything working with the durability, i'm trying to make it when they have the plugin on and they are holding the item the durability doesn't go down at all.
     
  4. Offline

    Plague

    event.getPlayer().getItemInHand().setDurability(xxx);
    I'd try to set it very high, but that wouldn't be exactly what you want, I think you'd have to catch an event where the durability is set to lower value, can't say which one from the top of my head.
     
  5. Offline

    Saturisk

    Alright ill work on that.
     
Thread Status:
Not open for further replies.

Share This Page