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

Saveable Scoreboards #6724

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Machine-Maker
Copy link
Member

@Machine-Maker Machine-Maker commented Oct 5, 2021

Couple problems with this that I don't know the best way to solve. If plugins get/join the returned completable future at the wrong time (like during plugin onEnable) it locks up cause the server is waiting for the plugin to load so the main thread (which at the moment is required for scoreboard creating/registration) can't register the scoreboard.

I'm not 100% sure that scoreboard registration needs to be done on the main thread. Would wrapping the WeakCollection of scoreboards in CraftScoreboardManager as a syncronized collection really solve that issue of scoreboard creation requiring the main thread.

EDIT: So I did go ahead and make the scoreboard collection a synchronous collection and removed the async catchers for scoreboard creation.

@Machine-Maker Machine-Maker requested review from a team as code owners October 5, 2021 18:29
@Machine-Maker Machine-Maker force-pushed the feature/saveable-scoreboards branch from 2e98355 to 42b4094 Compare October 5, 2021 20:48
@stale
Copy link

stale bot commented Dec 5, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@Machine-Maker
Copy link
Member Author

Rebased for 1.18.1

@stale
Copy link

stale bot commented Feb 11, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

private final CraftScoreboard mainScoreboard;
private final MinecraftServer server;
- private final Collection<CraftScoreboard> scoreboards = new WeakCollection<CraftScoreboard>();
+ private final Collection<CraftScoreboard> scoreboards = java.util.Collections.synchronizedCollection(new WeakCollection<CraftScoreboard>()); // Paper
Copy link
Member

Choose a reason for hiding this comment

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

if we wanna use a synchronised collection you'd need to wrap the getScores method iteration in a sync block over this

@Machine-Maker Machine-Maker force-pushed the feature/saveable-scoreboards branch from e565258 to 0d5fd28 Compare February 21, 2022 00:32
@stale
Copy link

stale bot commented Apr 24, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Jun 24, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Jul 2, 2022

This issue has been automatically closed because it has not had activity in a long time. If the issue still applies to the most recent supported version, please open a new issue referencing this original issue.

@stale stale bot closed this Jul 2, 2022
@Machine-Maker Machine-Maker reopened this Jul 3, 2022
@Machine-Maker Machine-Maker added the status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. label Jul 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pre-softspoon status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. status: rebase required
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

4 participants