Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Using the scoreboard per player

Recommended Posts

Ok so first of what i am trying to do.

I am trying to use the vanilla scoreboard to display information to a specific player. This is for a server side mod so i cant just access the scoreboard client side.

I have found a way to do this but its going to be a little tricky to implement so before i get started i want check if anyone knows a better way.


After digging through the scoreboard code i have found that i can do this using the following packets.


Sends the scoreboard objective to the client

S3BPacketScoreboardObjective(scoreObjective, 0)

Displays the objective in the sidebar

S3DPacketDisplayScoreboard(1, scoreObjective)

Updates a spacific score in the objecting.

S3CPacketUpdateScore(score, 0)


Working example


ServerScoreboard scoreboard = (ServerScoreboard) MinecraftServer.getServer().worldServerForDimension(0).getScoreboard();
ScoreObjective scoreObjective = scoreboard.getObjective("Test");
Score score = scoreboard.func_96529_a("brandon3055", scoreObjective);

player.playerNetServerHandler.sendPacket(new S3BPacketScoreboardObjective(scoreObjective, 0));
player.playerNetServerHandler.sendPacket(new S3DPacketDisplayScoreboard(1, scoreObjective));
player.playerNetServerHandler.sendPacket(new S3CPacketUpdateScore(score, 0));



The problem i encountered is if i use S3BPacketScoreboardObjective to add an objective that already exists or remove one that dose not exist it crashes the client.

This means i am going to have to come up with a tracking system to keep track of what objective each player currently has displayed and make sure i dont remove or add an objective that already exists. It would also have to keep track of when a player relogs.



Edit: On second thought i only need to send the player one objective which i can send on login. Then i can just change the name, contents and visibility of that objective as needed.

I am the author of Draconic Evolution

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.