Add text below player nameplate

Hi.

Is there currently a way to add text below a players nameplate.
Kind of like how some servers can display the health of a player above their head but below their nameplate
I want to do something like this just like this but using text and have no idea where to start or how

That is done via a scoreboard. Their score is shown, and then the display name of the objective.

Hmm… i keep getting this weird error/bug when testing my code.

For some reason, the text that i should have on me(which is none) is showing up on my partner
And the text which should be showing up on him is showing up on me

Here is the example:

Here is my code:

And here is an error that console is giving me:

Thanks in advanced

~Ty

The exception probably has something to do with this:

public void onPlayerConnectEvent(ClientConnectionEvent.Login e) {
    Player player = e.getCause().last(Player.class).get();

Three things are wrong here. First, the Player doesn’t fully exist yet. You need to use Join for that, not Login. Second, the player is the target, not the cause. So in ClientConnectionEvent.Join, you would use getTargetEntity. Third, even if they were in the Cause, last returns the least relevant object, not the most.

The logic error is because you make a new scoreboard for every player. Which scoreboard you have controls what scores you see, not what scores other people see. So your player with the king scoreboard, seeing health as ‘King’, sees everyone else as being a King since that is the scoreboard he sees. But they do not see him as a King, because they do not have the King scoreboard. Just use one global scoreboard, and assign different objectives to people.

alright. I changed the ClientConnectionEvent.Login to ClientConnectionEvent.Join.
I changed e.getCause()… to e.getTargetEntity and there seems to be no more errors.

Although. Im still having trouble getting the scoreboard to work properly. I tried creating one global scoreboard when the server is initialized but im still having trouble getting it to work properly. I am also unsure if i should create a different objective for each player or if i should create a objective for each different ‘text’ i want to display.

Im having a really tough time getting my head wrapped around scoreboards and how they work

Do you mean you don’t understand the scoreboard API, or regular Minecraft scoreboards?

Really, i dont understand either of them. I thought I had an idea of how they worked. but this really proves me wrong…in hindsight, I guess I should of tried to learn how minecraft scoreboards work before i tried doing something with sponge.

Often I quarrel with those who do not believe that knowing Java needs to be a precursor to writing Sponge plugins. But while I regard that as a strong recommendation, I would regard as an absolute necessity the knowledge of the Minecraft features you intend to manipulate with said plugin. I would therefore say that your best course of action is watching videos, reading the wiki, fooling around with commands, etc. Shouldn’t take more than a few hours to get a good handle on everything, but it will save you a headache in the long run.