Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming ServerScoreboard.objectives, because its purpose is unclear and it can be confused with Scoreboard.objectives #3850

Open
Papierkorb2292 opened this issue Apr 18, 2024 · 0 comments

Comments

@Papierkorb2292
Copy link

Version: 1.20.5-pre4+build.1

Because ServerScoreboard inherits from Scoreboard it can be confusing that both of them have a private objectives field. More importantly, they serve different purposes and I suggest renaming ServerScoreboard.objectives:

The purpose of Scoreboard.objectives is to keep track of all existing objectives known to the server. However, the purpose of ServerScoreboard.objectives is different: This field keeps track of all objectives whose contents should be synced to the client. The .contains checks on that field control whether a ScoreboardObjectiveUpdateS2CPacket should be send and objectives are only added to the field by setObjectiveSlot, when a new objective is set on a slot.

Similarly, I also think the two methods that make the direct modifications to the field should be renamed: ServerScoreboard.addScoreboardObjective and ServerScoreboard.removeScoreboardObjective, since their name currently suggests they would be called every time an objective is added or removed completely, when in reality, they only control which objectives are synced with the client.

As a new name, I suggest something along the lines of visibleObjectives or syncedObjectives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant