fix(inventory): prevent phantoms, wipes and dupes of inventory items#747
fix(inventory): prevent phantoms, wipes and dupes of inventory items#747olisikh wants to merge 8 commits intoMUnique:masterfrom
Conversation
65afed6 to
a6a8c81
Compare
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the stability and reliability of the inventory system by addressing potential issues leading to item wipes, duplications, and desynchronizations. It introduces stricter validation for item movements, implements a more resilient rollback mechanism for failed operations, and improves the robustness of backup inventory restoration processes. These changes aim to provide a more consistent and predictable inventory experience for players while offering better diagnostic capabilities for developers. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request significantly enhances item management and trade functionalities. It introduces more robust error handling and logging for item restoration during player login and trade cancellations, ensuring that items are restored reliably even if some fail. The item movement logic has been refined with a new IsMoveAllowed check for player states, corrected plugin parameter passing, and improved rollback mechanisms for failed moves, including critical logging for inconsistent inventory states. The inventory update process now prevents duplicate item entries and dynamically adjusts item counts. New comprehensive unit tests have been added for item movement and trade cancellation scenarios, including a test for graceful handling of invalid backup items during trade cancellation. Feedback suggests refactoring the FullStackAsync method to use a more semantically appropriate plugin for item consumption instead of ItemMoveFailedAsync, and removing the redundant AreTargetSlotsBlocked method.
This PR hardens item movement and rollback behavior to prevent inventory wipes, dupes, and desyncs during failed operations and edge-case states.
What changed
Effect
I have been running these changes on my local server and didn't see an issue, but this PR should be taken with a grain of salt.