Solved 1.9 PlayerInteractEvent fire 2 times

Discussion in 'Spigot Plugin Development' started by Eternirya, May 16, 2016.

  1. [​IMG]

    Fire 2 times when i right click block.

    So, i google that, its say one event is for main hand and one event for off hand.

    So, problem is i want to detect the event for main hand, guys you know how to do this ?[​IMG]
     
  2. It fires once for each hand, Event#getHand returns an EquipmentSlot enum value.
    Code (Text):
    public enum EquipmentSlot {
        HAND,
        OFF_HAND,
        FEET,
        LEGS,
        CHEST,
        HEAD;

        private EquipmentSlot() {
        }
    }
     
     
    • Informative Informative x 2
  3. Code (Java):
    if (event.getHand().equals(EquipmentSlot.HAND)) {
       //Code
    }
    if (event.getHand().equals(EquipmentSlot.OFF_HAND)) {
       //Code
    }
     
    • Informative Informative x 2
  4. WHATS THAT SKULL OMFG NAME?
     
  5. thanks everyone

    what ?
     
  6. THERES A TURTLE OVER THERE WHAT HEAD-SKULL THINGY IS THAT
     
    • Funny Funny x 2
  7. SkullOwner: 45c6ab4a-8aaa-4a21-8d31-75530e726203
     
    • Useful Useful x 1
  8. Code (Text):
    /give @p skull 1 3 {display:{Name:"Ur Turtle"},SkullOwner:{Id:"ef56c7a3-a5e7-4a7f-9786-a4b6273a591d",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTJlNTQ4NDA4YWI3NWQ3ZGY4ZTZkNWQyNDQ2ZDkwYjZlYzYyYWE0ZjdmZWI3OTMwZDFlZTcxZWVmZGRmNjE4OSJ9fX0="}]}}}
     
  9. Thanks! How did you figure that out?
     
  10. Google. Its looks bit different but its a turtle xD