Skip to content

Move scoreboard overrides to a separate field - #13378

Merged
lynxplay merged 3 commits into
mainfrom
feat/optimize-get-scoreboard
Dec 12, 2025
Merged

Move scoreboard overrides to a separate field#13378
lynxplay merged 3 commits into
mainfrom
feat/optimize-get-scoreboard

Conversation

@Owen1212055

Copy link
Copy Markdown
Member

Speeds up scoreboard fetching a bit, most notably when mutating scoreboard fields, which iterate over each player in the world

@Owen1212055
Owen1212055 requested a review from a team as a code owner December 8, 2025 17:51
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Dec 8, 2025
@Owen1212055

Copy link
Copy Markdown
Member Author

@copilot What are your opinions

Copilot AI commented Dec 8, 2025

Copy link
Copy Markdown

@Owen1212055 I've opened a new pull request, #13379, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors scoreboard override storage from a centralized HashMap in CraftScoreboardManager to individual fields in CraftPlayer instances, improving performance when mutating scoreboard fields that iterate over players.

Key Changes

  • Removed the playerBoards HashMap from CraftScoreboardManager
  • Added scoreboardOverride field to CraftPlayer with getter/setter methods
  • Updated all scoreboard override access to use the new player-based storage

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
paper-server/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java Removed HashMap field and updated methods to delegate scoreboard override storage to CraftPlayer instances
paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java Added scoreboardOverride field with getter/setter methods to store per-player scoreboard overrides

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java Outdated

@NoahvdAa NoahvdAa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this gave me +25 tps

@lynxplay lynxplay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My server was struggling with 2 players online, now I can host around 500 players on a single instance, thank you owen!

@feeeedox

feeeedox commented Dec 9, 2025

Copy link
Copy Markdown

Thanks for the PR. My server now goes so fast it travels back in time and prevents players from joining in the first place. 10/10 would merge again

@lynxplay
lynxplay merged commit e5e2c50 into main Dec 12, 2025
6 checks passed
@lynxplay
lynxplay deleted the feat/optimize-get-scoreboard branch December 12, 2025 21:58
@github-project-automation github-project-automation Bot moved this from Awaiting review to Merged in Paper PR Queue Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

8 participants