Name tag problems

Discussion in 'Spigot Plugin Development' started by Jaffaaaa, Sep 16, 2018.

  1. I'm using a invisible armour stand to display my Display Name (with rank + colours) on my head, however its a bit high up. I realise it could be that it's placing the nametag on top of the armour stand which is on top of my head, so how can I make the armourstand go down so its level with where it should be?
    [​IMG]
    My code:
    Code (Java):
    @EventHandler
          public void onUndisguiseEvent(PlayerJoinEvent event) {
             Player player = event.getPlayer();
           
             new BukkitRunnable() {
                 public void run() {
                     ArmorStand nameTag = (ArmorStand) player.getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND);
                     nameTag.setCustomName(player.getDisplayName());
                     nameTag.setCustomNameVisible(true);
                     nameTag.setMaxHealth(100000);
                     nameTag.setHealth(nameTag.getMaxHealth());
                     nameTag.setCanPickupItems(false);
                     nameTag.setVisible(false);
                     nameTag.setGravity(false);
                     main.map.put(player, nameTag);
                   
                     player.setPassenger(nameTag);
                 }
             }.runTaskLater(main, 10);
           
         }
     
    #1 Jaffaaaa, Sep 16, 2018
    Last edited: Sep 16, 2018
  2. your problem is that youre doing player.setPassenger(nameTag);

    This means that the armor stand will be riding on the player. That is the reason why it is so high. If you wish to change the name tag names, you should ideally use Teams and Scoreboards. a quick google search should get you where you want to be.
     
  3. Try with setting the armorstand small. Whatchout that things this way, might cause quite some lag when a lot of players are in the same place (Double up the entity count). I would suggest do what @minion325 suggested.
     
  4. Setting it to small does help a lot but not all the way there? Can i not manipulate the height. Also I want it to be an armourstand as I want to manipulate it in the future.
     
  5. Technically, you can set up a runnable that runs every tick and have a Map<Player, ArmorStand>. However, you will have to telport the armorstand to the player every second. You will also not set the armorstand as the passenger of the player. This is by far not the best method to do this so if you could tell us why you would need to manipulate the armor stand, perhaps we can help you find a better solution.
     
  6. That is a not a good way of doing it, I would recommend using GameProfile packets or the simple scoreboard with teams.
     
  7. If a different way is a lot better I can do that? But how do I do the scoreboard/GameProfile thing? I've searched on google but could only find people trying to find fixes for it, not an example or something. Can someone help?
     
  8. @Jaffaaaa Add this line
    Code (Text):
    nameTag.setMarker(true)
    Setting the ArmorStand as a marker does exactly what you want. Puts the name tag at the ArmorStands feet instead of it's head.
     
    • Agree Agree x 1
  9. 2008Choco

    Junior Mod

    Somewhat related blurb: iso2013 wrote MultiLineAPI to do this + a lot more. May be worth looking into :)
     
  10. Good but not quite there
    [​IMG]
     
  11. Try using a Silverfish or an Endermite with no AI
     
  12. The server uses 1.8 so I can't use #setCustomNameVisible(true); on anything that isn't armour stand.
     

Share This Page