Solved Keeping track of armor stands

Discussion in 'Spigot Plugin Development' started by PvPNiK, Feb 10, 2020.

  1. Hello,

    what the plugin needs to do:
    right-click block X.
    spawns armor stand X with an item in the right hand.
    right-click block X again, removed armor stand X.
    (for each block there is unique armor stand.)

    what the plugin does for now:
    right-click block X.
    spawns armor stand X with an item in the right hand.

    the problem I am having is keeping track of the armor stands.
    any idea on how to implement it?
    + armor stands are entities, I need a way to detect if the armor stand disappeared, even from commands, Entity#remove, and etc.
     
  2. keep a set or so of all your entities?
    as for keeping track of if theyve been removed, just check if the entity still exists in the collection before performing your logic, and have a periodic timer purge the collection of deleted entities
     
  3. Hashmap? Location, EntityID
     
  4. Figured it out,
    if you want to check how i made it:
    https://github.com/PvPNiK/WeaponHol...er/src/me/PvPNiK/wh/holder/HolderManager.java