PaperMC / PaperMC/Paper

PlayerInventorySlotChangeEvent not triggers by swapping item

Open
#9,690 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected behavior

PlayerInventorySlotChangeEvent should trigger when swap item with offhand in container

Observed/Actual behavior

PlayerInventorySlotChangeEvent not triggers when swap item with offhand in container
https://youtu.be/A3zPAAu2l8w

Steps/models to reproduce
    @EventHandler()
    public void onSlotChange(PlayerInventorySlotChangeEvent event) {
        Player player = event.getPlayer();
        ItemStack oldItem = event.getOldItemStack();
        ItemStack newItem = event.getNewItemStack();
        player.sendMessage(oldItem.getType() + " " + newItem.getType());
    }
Plugin and Datapack List

nope

Paper version

This server is running Paper version git-Paper-171 (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT) (Git: 33bec7f)
You are running the latest version

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 with PlayerInventorySlotChangeEvent and reproduce the offhand swap in a container on Paper 1.20.1 using the listener shown in the report. Trace the inventory swap handling to determine why the event is skipped; done means the event fires with the old and new item stacks for this action.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.