-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
base: master
Are you sure you want to change the base?
Saveable Scoreboards #6724
Conversation
2e98355
to
42b4094
Compare
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. |
42b4094
to
e565258
Compare
Rebased for 1.18.1 |
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 |
There was a problem hiding this comment.
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
e565258
to
0d5fd28
Compare
0d5fd28
to
bd836ba
Compare
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. |
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. |
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. |
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.