Hi there,
So I am trying to create a name tag feature for my plugin and this is what I am using.
getScoreboard Method:
setNameTag Method:
Now this works fine when the first player joins the server but, when the second person joins the server, their name tag gets set but the first player's name tag gets set back to normal and I have 0 idea why. Can anyone help? Thank you.
So I am trying to create a name tag feature for my plugin and this is what I am using.
getScoreboard Method:
Java:
public Scoreboard getScoreboard() {
Scoreboard scoreboard = getPlayer().getScoreboard();
if (scoreboard == null)
getPlayer().setScoreboard(scoreboard = Core.getCore().getServer().getScoreboardManager().getNewScoreboard());
return scoreboard;
}
setNameTag Method:
Java:
public void setNameTag() {
Scoreboard scoreboard = getScoreboard();
scoreboard.getTeams().forEach(Team::unregister);
Team team = scoreboard.registerNewTeam(rank.getName());
team.setPrefix(rank.getPrefix());
team.addPlayer(getPlayer());
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.ALWAYS);
}
Now this works fine when the first player joins the server but, when the second person joins the server, their name tag gets set but the first player's name tag gets set back to normal and I have 0 idea why. Can anyone help? Thank you.
