-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
GH-924 Fix synchronization bug. #924
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe changes introduce a new 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/WarpInventory.java (1)
246-258
: Improved formatting for readabilityThe code formatting makes the method call clearer and easier to read.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/WarpInventory.java
(5 hunks)eternalcore-core/src/main/java/com/eternalcode/core/util/CompletableFutureUtil.java
(1 hunks)
🔇 Additional comments (8)
eternalcore-core/src/main/java/com/eternalcode/core/util/CompletableFutureUtil.java (1)
6-18
: Good new utility class for handling async exceptionsThis class handles exceptions from CompletableFuture operations nicely. The private constructor prevents mistakes, and the utility method logs issues clearly.
eternalcore-core/src/main/java/com/eternalcode/core/feature/warp/WarpInventory.java (7)
4-4
: Added Scheduler import as neededThe Scheduler is required for the fix, so this import is necessary.
17-17
: Added required utility importAdding the CompletableFutureUtil import supports the new exception handling approach.
22-26
: Added needed imports for async operationsThese imports support the new async inventory creation functionality.
55-55
: Added Scheduler fieldAdding the Scheduler field allows running GUI opening on the main thread, which is needed for inventory events.
66-67
: Added Scheduler to constructor and initializationThe Scheduler is properly added to the constructor and initialized in the field.
Also applies to: 77-77
80-86
: Fixed synchronization issue with inventory openingThis change fixes the problem by making sure the inventory opens on the main thread using scheduler.run(). Using exceptionally() helps catch errors that might happen during async operations.
89-98
: Created method for async inventory creationThis new method handles getting the player's language asynchronously and falls back to the default language if needed. The exceptionally handler ensures errors are properly logged.
Initially, the warp GUI wasn’t working properly, so I added CompletableFuture#exceptionally. Using exceptionally isn’t strictly necessary, but including it helps uncover errors that aren’t immediately obvious, as they don’t automatically appear in the console.
After adding exceptionally, I encountered the following error:
My PulRequest fixes this error.