Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-3223

ArmorStand Hologram Disappearing with setRemoveWhenFarAway(false)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Minor Minor
    • None
    • None
    • Private plugin. Source located in main text.

      When using this code to generate invisible armor stands (holograms), the hologram is initially created when the server is loaded (as the plugin is written in my code). Then a few seconds later the holograms will disappear.

      /**
           * This will spawn an armor stand with a hologram type setup.
           *
           * @param name     The name to display over the hologram.
           * @param location The location to spawn the hologram.
           * @return Returns the generated entity.
           */
          private ArmorStand spawnArmorStand(String name, Location location) {
              String worldName = location.getWorld().getName();
              ArmorStand stand = (ArmorStand) Bukkit.getWorld(worldName).spawnEntity(location, EntityType.ARMOR_STAND);
      
              //Setup armor stand.
              stand.setSmall(true);
              stand.setBasePlate(false);
              stand.setCanPickupItems(false);
              stand.setCollidable(false);
              stand.setGravity(false);
              stand.setInvulnerable(true);
              stand.setVisible(false);
              stand.setRemoveWhenFarAway(false);
      
              //Set the armor stands name.
              stand.setCustomName(color(name));
              stand.setCustomNameVisible(true);
      
              return stand;
          }
      

       

      I wrote some additional code to test what was going on with the holograms.  The picture below shows when the holograms are initially created and set inside the world. Then less than one minute later (or when you move/teleport away) from them, they will unload. I have gone into GameMode 3 to check for their existence before and after.

      The holograms that stay loaded are the ones within the world spawn region (the protected region upon vanilla server startup).

       

      So, I think their may be a bug with the method setRemoveWhenFarAway(*false)* not working correctly. According to the API, all living entities implement this interface. ArmorStand implements this interface.

       

      Thank you for your time!

       

      More reading:

      Original problem stated here: https://www.spigotmc.org/threads/armorstand-hologram-disappearing-setremovewhenfaraway-false-not-working.237315/

            Unassigned Unassigned
            unenergizer Andrew
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: