Trigger when player puts pumpkin on head?

Discussion in 'Plugin Development' started by stuntguy3000, Jan 24, 2013.

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

    stuntguy3000

    Hello,

    Just wondering how could i get something to happen when a player puts a pumpkin on there head and something else to happen when they remove it?
     
  2. Offline

    bobacadodl

    Take a look at the InventoryClickEvent and check to see whether they are placing a pumpkin in their helmet slot.
     
  3. Offline

    stuntguy3000

    How do i check if they are actually placing a pumping?
     
  4. Offline

    Technius

    Get the item stack's type and see if it's the same as a pumpkin.
     
  5. Offline

    stuntguy3000

    Could you show me a code example? Thanks
     
  6. Offline

    gomeow

    I hate InventoryAPI, but I think this might work to check if they are withdrawing vs depositing:

    Code:java
    1. if(event.getSlotType() == SlotType.ARMOR) {
    2. if(event.getInventory().getItem(event.getSlot()) != null) {
    3. //Code here
    4. }
    5. }
     
  7. Offline

    keto23

    Code:java
    1. @EventHandler
    2. public final void onClickEvent(InventoryClickEvent e) {
    3. if (e.getSlot() == 5 && e.getCurrentItem().getType() == Material.PUMPKIN) {
    4. // Do silly stuff here
    5. }
    6. }
     
Thread Status:
Not open for further replies.

Share This Page