-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
IslandCache#islandsByUUID population #2262
Comments
I think this also has side effects for built in commands not working for us ( I think getIslandLocation is null here and we just fail. And also the user does not get any error feedback in this case. |
Can you give me some example code of where this returns null? E.g. a minimal addon or plugin that yields this result beause I cannot replicate. When the islands are loaded when the server starts, the The code in IslandCache for getting is basically this:
|
So I can't give you exact replication information, we don't restart the server every night, but something in that mix certainly causes said cache to be imperfect, leading to issues such as
Anyway, my minimal plugin is indeed just a command that calls IslandManager#getIsland to return an error message for players that don't have an island, but this was always false for everyone after a server restart ( I guess?). Specifically your code snippet:
This is kinda equivalent to
So it doesn't really populate the cache, it creates an empty cache. Cases in which the cache is actually filled, is when |
Yeah, I recently fixed a bug with teleporting home that sounds like the sort of issue you saw (#2267). Hopefully that'll help if you were seeing home teleport weirdness. |
So as it turns out, the exception that happens with the settings menu is now consistent for every user and also not solved with a reboot, it could be a regression from going to the most recent version due to the chest boat. As for the teleport/islandcache, I can't give you more insight as of yet. Maybe I could add some periodic debug logging to check the cache state on startup and at a later state, too. Since it happens for some players it feels like being related to some timing related thing, such as them joining/leaving at some point, doing some things, in relation to the server startpoint. |
Can you share logs? I don't see any errors so i'm not sure what you are seeing. |
This has been solved with edd7bcf I guess, so I'll update first. I'll also report back how the caching now works, but to give you the exact code I am using again (but I guess you'd still lack the side effects I have): return BentoBox.getInstance().getIslands().getIslands().stream().filter(island -> island.getMemberSet().contains(uuid)).findAny();
//return Optional.ofNullable(BentoBox.getInstance().getIslands().getIsland(plugin.getIslandWorld(), uuid)); Basically, I want to find the island of |
Expected behavior
IslandsManager#getIsland(World, UUID)
to return theIsland
(the first one) the player belongs to.Observed/Actual behavior
The method returns null, iterating over
IslandsManager#getIsland()
and filtering gets me there.Steps/models to reproduce
Call
IslandManager.getIsland(world, playser.getUniqueId())
BentoBox version
[02:48:48 INFO]: Running PAPER 1.20.4.
[02:48:48 INFO]: BentoBox version: 2.0.0-SNAPSHOT-b2521
[02:48:48 INFO]: Database: JSON
[02:48:48 INFO]: Loaded Game Worlds:
[02:48:48 INFO]: islands (AcidIsland): Overworld, Nether, The End
[02:48:48 INFO]: Loaded Addons:
[02:48:48 INFO]: AcidIsland 1.18.1-SNAPSHOT-b1008 (ENABLED)
[02:48:48 INFO]: Challenges 1.3.0-SNAPSHOT-b539 (ENABLED)
[02:48:48 INFO]: ControlPanel 1.13.1-SNAPSHOT-b61 (ENABLED)
[02:48:48 INFO]: Level 2.12.0-SNAPSHOT-b555 (ENABLED)
Plugin list
No response
Other
If I've interpreted the code around
islandsByUUID
correctly, it only contains entries when the player has been added to the island in that current runtime. Especially the computerIfAbsent statements should probably pre-populate the HashSets in a reasonable way, if the server is restarted.The text was updated successfully, but these errors were encountered: