PaperMC / PaperMC/Paper

PlayerPickItemEvent should be an InventoryEvent

Open
#11,372 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected behavior

The relevant packet for PlayerPickItemEvent (ServerboundPickItemPacket) is used by some mods to quick move items through the inventory to the player's hand. This event should extend InventoryEvent - it has all relevant Inventory context to provide the necessary information for an InventoryEvent.

Observed/Actual behavior

When sending a ServerboundPickItemPacket on slot 9, this event will fire and cause inventory manipulation without triggering any InventoryEvent (such as an InventoryClickEvent). This event also does not extend InventoryEvent, making it semi-invisible to Javadocs browsing for trying to handle Inventory-related exploits and bugs.

Steps/models to reproduce
  1. Implement a system utilizing InventoryEvents to prevent players from moving items
  2. Trigger a ServerboundPickItemPacket on a relevant slot
  3. PlayerPickItemEvent will fire, but no InventoryEvents will fire. The inventory will, however, still be mutated.
Plugin and Datapack List
[22:05:57 INFO]: Server Plugins (21):
[22:05:57 INFO]: Paper Plugins:
[22:05:57 INFO]:  - BKCommonLib
[22:05:57 INFO]: Bukkit Plugins:
[22:05:57 INFO]:  - Essentials, FastAsyncWorldEdit, GSit, helper, helper-sql, HuskyScreen, LuckPerms, Multiverse-Core, Multiverse-NetherPortals, packetevents
[22:05:57 INFO]:  *PlasmoDynamicSources, PlasmoVoice, PlugManX, ProtocolLib, pv-addon-lavaplayer-lib, spark, SubserverAdditions, Train_Carts, ViaVersion, WorldGuard
[22:06:09 INFO]: There are 2 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)]
[22:06:09 INFO]: There are no more data packs available
Paper version
Unknown version
Previous version: git-Paper-280 (MC: 1.20.2)

Note: This paper fork only has small alterations for how Maps are updated and does not have any sweeping changes

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 locating PlayerPickItemEvent, InventoryEvent, and the handling path for ServerboundPickItemPacket. Compare the event hierarchy and available inventory context, then use the listed reproduction steps to verify that picking an item is represented as an InventoryEvent and that inventory manipulation is no longer invisible to InventoryEvent handlers.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.