mojira.dev
MC-254353

A packet to remove the score is always broadcast when a score is reset

The bug

When /scoreboard players reset <targets> is executed or /scoreboard players reset <targets> <objective> resets the last score, a packet to remove the score will be broadcast even if none of the score's objectives is in the tracked objectives. This introduces unnecessary performance overhead to both the server and the clients.

Code analysis

net.minecraft.server.ServerScoreboard

public void onPlayerRemoved(ScoreHolder holder) {
    super.onPlayerRemoved(holder);

    // A packet is broadcast unconditionally.
    this.server.getPlayerList().broadcastAll(new ClientboundResetScorePacket(holder.getScoreboardName(), null));

    this.setDirty();
}
public void onPlayerRemoved(ScoreHolder holder) {
    super.onPlayerRemoved(holder);

    // A packet is broadcast unconditionally.
    this.server.getPlayerList().broadcastAll(new ClientboundResetScorePacket(holder.getScoreboardName(), null));

    this.setDirty();
}

 

Attachments

Comments 1

I can confirm this behavior.

[media]

intsuc

(Unassigned)

Community Consensus

Platform

Low

Networking, Performance

scoreboard

1.19, 1.19.1, 1.19.2, 22w42a, 1.19.3 Release Candidate 1, ..., 24w33a, 1.21.4, 25w04a, 1.21.5, 25w16a

Retrieved