["SOLVED"] Holograms & Nametags Problems

Discussion in 'BungeeCord Plugin Development' started by DevCubeHD, Jun 22, 2015.

  1. MOVED THE SECOND QUESTION TO: https://www.spigotmc.org/threads/customname-hologramm-with-slimes.74809/
    FIRST PROBLEM SOLVED, IF YOU NEED TOO, SEND MY A MESSAGE


    Hey Community,

    I am coding on a minigame thats like Trouble in Terrorist Town. But after some coding I had two questions at the end.

    Question 1:
    At the moment I took the solutiob with NBT Tags. "Marker and Invisible". The problem is, that I can't show different texts to different players, because the armostands are Serverside and so they have all to see the same (or not?). (Is there any abillity to spawn the armorstands with NBT tags clientside or something like the .showSignChange() for mob names?) Thats how it looks now:
    [​IMG]
    Code with NBT Tags:
    Code (Text):
    Slime holo = (Slime) locs.getWorld().spawnEntity(locs, EntityType.SLIME);
                holo.setSize(1);
                holo.setCustomName(GunManager.guns.get(0).getName());
                holo.setCustomNameVisible(true);
     
                NBTTagCompound compound = new NBTTagCompound();
                ((CraftEntity) holo).getHandle().e(compound);
                compound.setInt("NoAI", 1);
                compound.setInt("Silent", 1);
                ((CraftEntity) holo).getHandle().f(compound);
    Question 2:
    That question is about collecting items in TroubleTown by right-clicking the slimes. Thats how it looks now. But when in the slime is a head, then it looks buggy.
    [​IMG]
    http://i.imgur.com/QVukzB9.png

    The Slime should be invisible and a head should be in it. Its because I want that the name is there when the player hovers over the head. If I just make the slime invisible, the name is also gone and nothing happens on hovering, exept when I am in Gamemode 3. In GM3 it works and looks like it should:
    [​IMG]
    http://i.imgur.com/3mv9zOV.png
    So is it right. But how can I do it in Gamemode 2? :(

    Thanks!
    ~DevCube
     
    #1 DevCubeHD, Jun 22, 2015
    Last edited: Jun 29, 2015
  2. Try to remove the CustomNameVisible and instead of hiding it, just give it a Invisibility effect (Infinite and without particles)
     
  3. *spamish message*
    Hes looking a wayto have a mob with a CustomName visible when he hovers it in GM2 as it works with GM3 (Like on TTT)
     
  4. Thank you both. There were two problems.. I will try now to solve them answer in some Minutes
     
  5. Done... Didn't work..
     
  6. Tried, you will have instead to find a good solution, I will be searching something similar to this with a solution ;)
     
  7. Thank you! I will search for the right code to make some custom replacements.
     
  8. Sorry, what did you ment?
     
  9. That I will be googling for this.
     
  10. @DevCubeHD

    If you want to create a custom hologram with information you could use IndividualHolograms add something like this

    Give all players a hologram:
    Code (Text):
    HologramManager.createNewHologram(HOLOGRAM_ID, LOCATION, Arrays.asList("Hologram","%myvariable%"));
    and then to translate the %myvariable%:
    Code (Text):
    @EventHandler
        public void onPlayerReceieveHologram(PlayerReceiveHologramEvent e) {
            Hologram hologram = e.getHologram();
            for (int i = 0; i < hologram.getLines().size(); i++) {
                hologram.setLine(i, hologram.getLine(i).replaceAll("%myvariable%", "myVariable"));
            }
            hologram.update();
        }
     
    • Agree Agree x 1
  11. Thaaaanks
     
  12. No Problem!
     
  13. Okay thx, Ive done too
     
  14. T
    That Event doesn't exist... can I just have the source, where you let the plugin show JUST ONE PLAYER the placeholder?
     
  15. There is one Problem.... It doesnt work xD
     
  16. It doesn't show? Or is there an error? Worked for me when I implemented it into a different plugin.
     
  17. All players see the same holograms and only one is shown from 2.
     
  18. Any errors in console, what version of spigot are you using?
     
  19. 1.8.6, No errors. Both create Lines unter each other