You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Version: 1.20.5-pre4+build.1
Because
ServerScoreboard
inherits fromScoreboard
it can be confusing that both of them have a privateobjectives
field. More importantly, they serve different purposes and I suggest renamingServerScoreboard.objectives
:The purpose of
Scoreboard.objectives
is to keep track of all existing objectives known to the server. However, the purpose ofServerScoreboard.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 aScoreboardObjectiveUpdateS2CPacket
should be send and objectives are only added to the field bysetObjectiveSlot
, 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
andServerScoreboard.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
orsyncedObjectives
.The text was updated successfully, but these errors were encountered: