Armor Stand Place Event?

Discussion in 'Spigot Plugin Development' started by Tomahawk2001913, May 29, 2015.

  1. I am having trouble finding when an armor stand is placed and who placed it where. Does anybody know how to handle this? As close as I can guess I will have to use the PlayerInteractEvent.
     
  2. Inkzzz

    Resource Staff

    BlockPlaceEvent
     
  3. Does not work. I believe it is because Armor Stands are entities not blocks.
     
  4. Try the EntitySpawnEvent and check if the entity is an instanceof ArmorStand and then do your code.
     
    • Agree Agree x 1
  5. this should work, because:
    [​IMG]
     
  6. Code (Text):
    public void onEntitySpawn(EntitySpawnEvent evt) {
        Entity ent = evt.getEntity();
        if(ent instanceof ArmorStand) {
            // Armor Stand spawned.
        }
    }
     
  7. How do I get the Player that placed it?
     
  8. You could check in the PlayerInteractEvent or even the BlockPlaceEvent if the item in their hand is an armour stand and if it is then you can do your code.
     
  9. Inkzzz

    Resource Staff

    You can get the location of the entity, then do a for loop of near by entites
     
  10. Thanks, that worked.