Skip to content

Async alldatabank - #3

Open
FireInstall wants to merge 69 commits into
masterfrom
async-alldatabank
Open

Async alldatabank#3
FireInstall wants to merge 69 commits into
masterfrom
async-alldatabank

Conversation

@FireInstall

@FireInstall FireInstall commented Jan 15, 2025

Copy link
Copy Markdown
Contributor

Done.
Will test and commit bugfixes.
But Logic-wise it is finally compleate, and this time as async as possible

FireInstall and others added 30 commits April 2, 2023 12:39
added async done feedback
fixed case issue with names
fixed error when about subcommand was called
don't let the player put anything into the treasure
delete treasure files when delete command was called instead of just clearing them
some code clean up
…t command was slightly refactored: You have to use parameter player, treasure or who to specify what list you want to have.

proper handle global uuid
fixed forget player not working
fixed some tab completes scanning for the wrong argument
database doesn't use extra player table, but the uuid as direct key
fixed wrong saving of database config data
fixed dragging items in own inventory
fix spelling errors
better exception logging
update Mc version
 - sub commands use a common abstract class as parent
 - translations get managed and loaded from a ressource bundle
 - config file is delivered in jar
 - database does not use a separate table per treasure
 - don't use static functions to get instances
 - permissions have parents we don't need to check them individually anymore
 - make use of CompletableFuture instead of weird callbacks
Treasures now get identified by an id instead of a location
Import legacy data does not depend on the old plugin to be loaded anymore

 sill todo:
  - save default treasure loot as well in the database
  - check what happens if a treasure get's open, and it's inventory size does not match the expected one.
  - formatting in RessourceBundle
  - somehow list known treasure locations
  - get list of all known treasure ids
This means we only cache all treasure related data only on demand and have no fast way to know how many treasures are on the server anymore.
some translations
fixed database
fixed missing static HanderList access
added Util for getting main treasure block
fixed peeked treasures getting saved twice
fixed being unable to edit treasures
fixed wrong messages
more lang formatting
switched from string to ULID to identify treasures.
Ulid are ordered by time, as Ksuid and UUIDv7 would (important for fast database access), while staying compatible to UUID, as well as being short and readable.
Addressing treasures by an autoincrementing int would be slightly faster but would allow for async problems (fetching the last id) to happen.
So the id has to be determined externally and a guid is the only way to do this consistent.
The downside is we can't name our treasures or will be able to use a non UUID compatible uid anymore.
If UUIDv7 was supported natively by Java I wouldn't have chosen ULID, but since I do need a third party lib anyway, may as well use the thing that produces shorter and genrally more readable strings.
Compaired to Ksuid ULID is faster, shorter and while in 100 years this plugin won't get used anymore, it's probably more likely than running in a duplicate ULID with per millisecond unique random ids. Also, as mentioned earlier Ksuid's are not compatible with UUID, making future Development with native Javacode hard.
Have a read yourself:
https://blog.daveallie.com/ulid-primary-keys/
https://news.ycombinator.com/item?id=25593165
segmentio/ksuid#8
Alternative approches:
https://github.com/azam/ulidj
https://github.com/cowtowncoder/java-uuid-generator
https://github.com/f4b6a3/uuid-creator
https://github.com/f4b6a3/ksuid-creator
changed how forget time works: Now it doesn't wait to reset until the player has emptied the treasure fully.
That part was from earlier days of development, where players where able to put stuff into the treasure.
Fixed main command name
Make better use of adventures build-in placeHolder-system: Formatter
@FireInstall

Copy link
Copy Markdown
Contributor Author

Changes since last review:

Fixed:

  • create command failing because it was not waiting until a fetch for the treasureInfo was properly compleated
  • allow caching of not existing (most likely deleted) treasures
  • forget period mechanism was broken after the first reset (always remembered first time of opening even after reset)
  • treasures not getting deleted if broken
  • next buttons on lists not working
  • worldguard flag not getting registered

Features:

  • Fail and shutdown if database tables are missing in runtime instead of silently recreating them

…ding on the old one

(and risk the old object becoming orphaned peace of way to big memory junk)
dropped dependency to snakeyml
this means we drop from version 2.5 back to 2.2.
snakeyml is shipped with the paper api.
…it way more human-readable in the process.

- moved creation of some core classes into the constructor of the plugin - where ever it was possible.
- split legacy import into smaller classes to improve readability
   UUIDs now only get fetched when really necessary. This builds on internal data and may have to get changed in the future!
   blocked multiple imports happening at the same time
   Switched to Configurate from Bukkits config system (at least for now just in legacy import) for better type handling and readability
   Switched to FileVisitor for better performance and error handling
…profile.

Should fix waring on startup.
Since the UUID is now hardcoded, we could very well just create a record class and store the name and id ourselves.
- bump version
- added standard config option
- close commandInventories when reloading
- remove default style in MessageManager since there is a better way.
- all 'fresh' found treasures don't have any "first found" timestamp attached to them any more to make them more in line with expectations
@FireInstall

Copy link
Copy Markdown
Contributor Author

@Schpammer I implemented all your requested changes.
The logging of all Locations is in the #async-alldatabank-logger branch, since I'm not a fan of the concept.

FireInstall and others added 7 commits August 4, 2026 15:44
forget duration pinned down by an Instant.
Like in case of every day 8pm o clock or every monday or anything periodic like this.

This also resulted in a free unlock by Instant system, like the Treasure stays locked until tomorrow 6pm or smth like that.
Although I didn't add any dedicated Command or user sided list info for it yet.
[Fix] missing colour tags in lang files
[Fix] allow whitespace in instant argument
Thanks gradle making projekts properties access harder -.-
Drop commons-collections4 dependency
procedes to open anyway
[bump] 26.2, gadle
@FireInstall
FireInstall force-pushed the async-alldatabank branch 2 times, most recently from 8f46f29 to 25f3df0 Compare August 5, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants