Armorstand Help

Discussion in 'Spigot Plugin Development' started by VivianMusic, Aug 2, 2018.

  1. I have a custom object for a special armorstand. How would I be able to get the location of a specific armor stand and do things with them in other classes (AND BETWEEN RELOADS)
     
  2. Just saved them to a file, set all your keys and values, and JavaPlugin#onEnable() loop through all your keys and values and make that object again (of course deleting them after loaded).
    You wouldn't be making a new instance of that object obviously, so you could add them to a static list in that armorstand object, and just have a static method to retrieve them by a unique identifier.
     
  3. What it is is actually a chunk loader that players can place that keep their mob grinders and stuff loaded. I want it to have a countdown in a hologram.. here's the "visual" part I have of it so far.

    https://i.gyazo.com/f8bab79162805f4ce434ed0900a8fce0.mp4
    [​IMG]

    How could I save it to the config and have auto incrementing numbers? I don't want to completely remove them on reload/restart. Or would I have an onDisable method that loops through them all and deletes them, then in onEnable, replace them?
     
  4. That sounds about right. You could even make a custom constructor including the time the chunk saver left off on, etc...

    A fair disclaimer: I have never worked with armorstands.
     
  5. So, inside my ChunkSaver class:
    Code (Text):
    ArrayList<ArmorStand> stands = new ArrayList<ArmorStand> ();
    Code (Text):
        public void deleteArmorStand () {
            for(ArmorStand as: Bukkit.getServer().getWorld("world").getEntitiesByClass(ArmorStand.class)) {
                if(stands.contains(as)) {
                    as.remove();
                    as.eject();
                }
            }
        }
     
  6. Now its just going to be hard to make a Manager class for this...