Skip to content

Fix cursor item being lost when PlayerDropItemEvent is cancelled and … #12475

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

FlorianMichael
Copy link
Contributor

…the player inventory is full

See this video for a tutorial on how to reproduce this issue: https://youtu.be/xonJe2S7jQ8. Note that you also need to have the PlayerDropItemEvent cancelled in the test plugin.

@FlorianMichael FlorianMichael requested a review from a team as a code owner April 25, 2025 02:12
@github-project-automation github-project-automation bot moved this to Awaiting review in Paper PR Queue Apr 25, 2025
@B1ue-Bandit
Copy link
Contributor

Listen to InventoryClickEvent instead and cancel it if the click type is DROP

@FlorianMichael
Copy link
Contributor Author

What? The event is cancellable for a reason and this is clearly a wrong implementation, why would this be a proper fix?

@B1ue-Bandit
Copy link
Contributor

No no, you're right. Your fix would be a welcome change, I was just suggesting a workaround for the time being but I probably should've said that

@FlorianMichael
Copy link
Contributor Author

FlorianMichael commented Apr 25, 2025 via email

@lynxplay
Copy link
Contributor

lynxplay commented Apr 25, 2025

This only resolves the issue when dropping the entire stack on cursor.
Dropping a single stack (single item from a stack of e.g. 64) from the cursor does still loose items (specifically, the items left in the cursor being overridden by the dropped stack)

FlorianMichael and others added 2 commits April 26, 2025 16:32
…the player inventory is full

See this video for a tutorial on how to reproduce this issue: https://youtu.be/xonJe2S7jQ8. Note that you also need to have the PlayerDropItemEvent cancelled in the test plugin.
@lynxplay lynxplay force-pushed the fix/player-drop-item-event branch from c1798f0 to 15073e2 Compare April 26, 2025 14:32
@github-project-automation github-project-automation bot moved this from Awaiting review to Awaiting final testing in Paper PR Queue May 3, 2025
@Clexus
Copy link

Clexus commented May 8, 2025

A question, what if player quit the game with full inventory and items on cursor? will them drop or just disappear

@FlorianMichael
Copy link
Contributor Author

@Clexus The item will be lost, I also noticed something similar happening when using the bundle item.

@aerulion
Copy link
Contributor

For reference, there has already been a discussion about this issue (#7726 and #7727). Although I still like the idea of having the overflow consumer described in the linked pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Awaiting final testing
Development

Successfully merging this pull request may close these issues.

6 participants