PaperMC / PaperMC/Paper

Possible item loss when cancelling PlayerDropItemEvent

Open
#7,726 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: accepted type: bug version: 1.19
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

Assuming a player stands inside a pile of dropped items, then starts moving an item in his inventory with his cursor and thereby filling the empty slot with any of the dropped items. If the player now clicks outside his inventory to drop the cursor item, the event should get cancelled and the item should remain attached to the cursor.

Observed/Actual behavior

When clicking outside the inventory the item will simple get deleted if the players inventory is full.

Steps/models to reproduce
  1. Cancel all PlayerDropItemEvents.
  2. Stand in a pile of dropped items with a full inventory.
  3. Move an item in your inventory with your cursor.
  4. Click outside the inventory in order to drop the item.
  5. Watch the item being deleted.
Plugin and Datapack List

Just a test plugin cancelling the event.

Paper version

This server is running Paper version git-Paper-283 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT) (Git: f8e8d6c)
You are running the latest version
Previous version: git-Paper-277 (MC: 1.18.2)

Other

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue on Paper git-Paper-283 (MC 1.18.2) with a test plugin that cancels all PlayerDropItemEvents, following the five steps in the report. Trace the inventory drop and PlayerDropItemEvent handling involved in the full-inventory case; done means the cursor item is retained when the event is cancelled.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.