Skip to content

PlayerPickItemEvent should be an InventoryEvent #11372

@codeHusky

Description

@codeHusky

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    Status

    🕑 Needs Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions