Solved ArmorStand disable interact (Remove items)

Discussion in 'Spigot Plugin Development' started by Dantesudante, Jun 1, 2017.

  1. How I can disable interact of an ArmorStand? So the players are not able to remove/place/change the armorstand's items
     
  2. Use the PlayerArmorStandManipulateEvent.
     
    #2 TheBlackTeddy, Jun 1, 2017
    Last edited: Jun 1, 2017
  3. Code (Java):

    @EventHandler
    public void OnInteractAtEntity(PlayerInteractAtEntityEvent e) {
      e.setCancelled(true);
    }
     
    Don't forget to check the entity type tho.
     
  4. Why use that if you can use the PlayerArmorStandManipulateEvent? This will only fire when player interacts with ArmorStand and not every single entity :p Also, you can manipulate the armorstand with this event ;)
     
  5. You can allways check the entity

    I've send this code becouse it is the one i used till now (to prevent other actions with armorstands)

    "Also, you can manipulate the armorstand with this event" What? This works fine for me
     
  6. It works both but I rather use PlayerArmorStandManipulateEvent instead of the PlayerInteractAtEntityEvent.
     
    • Agree Agree x 2
  7. You can set the DisabledSlots NBT tag to 2039583.