Prevent head item from being removed from armor stand?

Discussion in 'Plugin Development' started by olsyboy, Aug 20, 2015.

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

    olsyboy

    Code:
    worldName.spawn(rideLocation, ArmorStand.class)
    armorStand.setHelmet(headMaterial)
    
    How can I prevent the helmet item from being removed by a player right clicking?
     
  2. Offline

    mine-care

    Cancel PlayerInteractEntityEvent for the the entity.
     
    olsyboy likes this.
  3. Offline

    olsyboy

    How do I cancel an event for a specific entity?
     
  4. @olsyboy @mine-care
    PlayerArmorStandManipulateEvent*, PlayerInteractEntityEvent isn't called, because the armor stand event has an own HandlerList, but something like EntityDamageByEntityEvent doesn't.
    To cancel for a specific entity either do something special with it like give it a specific name or add it to a list. If the entity of the event has the special thing you can cancel it.
     
    Last edited: Aug 20, 2015
  5. Offline

    olsyboy

    Ok, but how do I cancel the event for a named entity?
    Like here:
    Code:
        @EventHandler public void onVehicleEntityCollision(VehicleEntityCollisionEvent event){
            event.setCancelled(true);
        }
    
    I don't want to cancel the event for ALL minecarts, just the minecart I have named minecart1
     
  6. @olsyboy
    Entity#getCustomName()
    String#equals(otherString)
     
  7. Offline

    olsyboy

    ??
    How can this work in my example?
     
  8. Offline

    olsyboy

  9. Offline

    olsyboy

  10. @olsyboy
    It means it's a (non-static) method from within the class
     
    olsyboy likes this.
Thread Status:
Not open for further replies.

Share This Page