By Mateusz Jasiński · Updated
How to find item dupes in a Minecraft server's menus
Most item dupes on a Paper server come from plugin menus, not from the game. A menu is a normal inventory window, so every click a player can make in a chest works in it too: shift-click, number keys, drags, double-click collect, drop keys, closing the window halfway through. A dupe is a menu that handles some of them and forgets the rest. To find one, try every kind of click on every menu while counting your items, or let bots do it: IgniteTestTool's GUI fuzzer clicks a menu thousands of times and reports each dupe with the clicks that cause it.
Signs a menu dupes
| What you see | Likely cause | Where to look |
|---|---|---|
| A player has a menu button item in their inventory | A click type the menu does not cancel | Shift-click, number keys, drags |
| A stack grows after using a menu | Items moved into the menu are kept by both sides | Shift-click and double-click from the player's own inventory |
| A reward or refund paid twice | Logic runs on close as well as on click, or twice under lag | InventoryCloseEvent, async callbacks |
| Money goes up with no items gone | A sell or buy path that does not check the stack it took | The menu's sell logic, run fast and twice |
| An item shows up, then disappears on reopen | Not a dupe: the client guessed and the server corrected it | Nothing, but check the server-side count to be sure |
The last row matters when you test by hand. The client tells the server what it thinks the slots look like after a click, the server does the click itself, and for any slot that does not match it sends back the correct contents (Click Container packet). A flicker is not a dupe. An item still there after you close the menu and relog is.
How menu dupes happen on Paper
Every click in a window reaches plugins as an InventoryClickEvent with an InventoryAction and a ClickType. Paper lists 25 actions and 14 click types. Menus break where a plugin only handles a few.
Shift-click. MOVE_TO_OTHER_INVENTORY moves a stack to the opposite inventory. A menu that only cancels clicks on its own slots still lets a shift-click from the player's inventory push items into the menu, where the plugin may store them, return them or count them as payment.
Number keys and the offhand key. NUMBER_KEY and SWAP_OFFHAND swap the clicked slot with a hotbar slot or the offhand (HOTBAR_SWAP). A menu that checks the cursor item misses these, because nothing ever sits on the cursor. getHotbarButton() returns 0 to 8 for the key, or -1 for the offhand swap.
Drags. Holding a stack and dragging it over several slots is not a click. Paper's docs say it plainly: "In case of a drag action within an inventory, InventoryClickEvent is never called." It fires InventoryDragEvent instead, and a menu with no drag listener lets items be painted straight into its slots.
Double-click collect. COLLECT_TO_CURSOR searches the inventory for the same material and puts it on the cursor. Double-click a matching item in your own inventory and it can pull display items out of the menu above it, even though you never clicked the menu.
Drop keys and middle click. Q and ctrl-Q (DROP, CONTROL_DROP) drop from a slot without picking it up. Middle click (CLONE_STACK) makes a full stack for creative players, so a staff member in creative can dupe from a menu a survival player cannot.
Bundles. Six newer actions move items in and out of bundles, like PICKUP_ALL_INTO_BUNDLE. A plugin that only blocks the actions it knows lets these through.
Closing in the middle of a click. The click event fires while the inventory is being changed. Paper says methods that change the view, closeInventory() and openInventory() among them, should never be called from the handler; schedule them for the next tick instead. A menu that swaps windows inside the handler can leave an item on the cursor while it also lands somewhere else.
Lag and async races. A shop menu that checks the balance on another thread and hands out the item in a callback can be clicked five times before the first callback runs. Each click passes the check, and each callback pays out. Two players clicking the same slot of a shared menu at once can do the same.
The display item that was never meant to move. A menu of panes and buttons is still a chest to the client. If any path lets one out, the player owns a "button" with a name and lore other plugins may trust.
Check a plugin's menus by hand
Use a copy of the server
Never test dupes on the live server. Copy it, or set up a test server with the same plugins and configs.
Carry known items
Fill your inventory with stacks you can count: 16 diamonds, 32 of a block, one named item. Write the numbers down, and your balance if the menu touches money.
Go through every click type on every slot
Left, right, shift-left, shift-right, number keys 1 to 9, F for offhand, Q and ctrl-Q, double-click, drag across several slots, click outside the window. Do each on the menu's slots and on your own inventory under it.
Close and reopen at odd moments
Press Escape right after a click, click fast several times in a row, and reopen the menu straight away. Try with an item still on the cursor.
Count again for real
Close the menu, relog, then count. A number that grew is a dupe. A new item you did not earn is an escape.
Try it with two accounts
For shared menus, like a team chest or a shop with stock, click the same slot from two players at the same moment.
That is about 20 moves per slot, times every slot and every menu. Enough for the obvious dupes, nowhere near enough for a race.
Code mistakes that cause dupes
For plugin developers, almost every menu dupe is one of these:
- Checking the wrong event. All the logic sits in
InventoryClickEventand drags go through untouched. Or rewards are paid onInventoryCloseEvent, which cannot be cancelled and fires for every way a window closes: the player, a plugin, a new window opening, death, teleport, disconnect. - Checking the wrong inventory or slot.
getSlot()can be the same number in the menu and in the player's inventory, because a view links two inventories.getRawSlot()is unique within the view, so use that. And find your menu by its holder, not by its title: Paper's docs call inventory names "unreliable" for this. - Allowing by default. A switch over the
InventoryActionvalues you thought of, with everything else allowed. New versions add actions, as bundles did. - Trusting the item. Deciding what a button does from the clicked item's name or lore. A player can rename an item to match. Map slots to actions in your own code.
- Changing slots without cancelling. Paper notes that slots changed by the click can be overwritten after your handler, so cancel and apply the change yourself, or do it next tick.
setCursoron the click event is deprecated because it causes mismatches between the player and the server. - Check now, pay later. Async work with no per-player lock, so the same click passes the check many times.
For a menu the player only clicks, the safe default is to cancel everything while it is on top:
@EventHandler(priority = EventPriority.HIGHEST)
void onClick(InventoryClickEvent event) {
if (!(event.getView().getTopInventory().getHolder(false) instanceof ShopMenu menu)) {
return;
}
event.setCancelled(true);
if (event.getRawSlot() >= menu.getInventory().getSize() || event.getClick() != ClickType.LEFT) {
return;
}
menu.handle((Player) event.getWhoClicked(), event.getRawSlot());
}
@EventHandler(priority = EventPriority.HIGHEST)
void onDrag(InventoryDragEvent event) {
if (event.getView().getTopInventory().getHolder(false) instanceof ShopMenu) {
event.setCancelled(true);
}
}Shift-click, number keys, double-click and drags from the player's own inventory are cancelled too, because the check is on the top inventory, not the clicked one. If the menu has slots players may put items into, that is where you need a full list of actions, and where a fuzzer earns its keep. A cancelled event still goes to other plugins, so a listener that un-cancels it later can still break this.
Let bots do the clicking
IgniteTestTool has a GUI fuzzer that does the hand check above with a real bot on a real Paper server, at 8 moves a second by default, for as long as you give it.

Its moves are left, right, shift, double click, number keys 1 to 9, offhand swap, Q and ctrl-Q, drags across slots, middle click, clicks on the player inventory, clicks outside, bursts of 6 to 20 clicks, close right after a click and reopen. With bot2, two bots shift-click the same slot at once, which is the shared-menu race from above.
Start a run from the Fuzz page, or over HTTP:
curl -H "X-ITT-Token: $TOKEN" "localhost:8767/fuzz/start?bot=FuzzBot&root=/shop&duration=10m&seed=42&setup=give%20%7Bbot%7D%20diamond%2016"
curl "localhost:8767/fuzz/status"
curl "localhost:8767/fuzz/report?format=html" > fuzz.htmlroot is the command that opens the menu, and setup gives the bot something to shuffle. To fuzz a whole plugin, crawl its menus first and pass graph=<crawl job>: each reopen picks one of the crawled menus at random.
After every move the fuzzer counts the bot's inventory, armor, offhand, crafting grid and cursor per item id and components, next to the menu's own slots. It checks a change again after settle (400 ms), so the client's guesses from the table above do not count. What it reports:
| Finding | Meaning |
|---|---|
dupe | An item the player had grew, and not because it came out of the menu |
escaped | A menu's display item ended up with the player |
gain | A new item, maybe a real reward; allow skips ones that are allowed |
loss | Items gone, not dropped and not moved into the menu |
total | A server-side number grew, like a balance |
kick | The bot was disconnected; it rejoins and goes on |
exception | A server error, tied to the move that ran when it was logged |
For money dupes, totals=balance=eco balance {bot} runs that command every 100 moves and flags a balance that goes up. Items picked up from the ground are subtracted, and drops excuse losses, so a normal drop is not reported.
Slots whose name or lore looks unsafe, like delete, reset or confirm, are skipped; skip adds a regex and safe=0 turns the list off. The fuzzer also refuses a server that is not on your machine or local network unless you pass confirmHost=1.
From finding to fix
Each finding is saved as a scenario, fuzz-<job>-<n>-<kind>.yml, with the last moves (up to 40) from a fresh open of the menu. Play it again after a fix:
curl -H "X-ITT-Token: $TOKEN" "localhost:8767/scenario/run?name=fuzz-1-1-dupe.yml"The same seed on the same menus gives the same moves, so a run can be repeated. Two limits: a replay starts with whatever the bot holds at that point, so a dupe that needed items from earlier moves may need them again, and two-bot moves replay one after the other, not at the same moment.
Once fixed, add a check at the end of the replay and put it with your other scenarios, so CI fails if the dupe ever comes back. The server agent can also tell you whether your plugin cancelled the event at all:
- {do: server, path: events/watch, type: "InventoryDragEvent", as: mark, field: mark}
- {do: action, action: fuzzClick, move: left, slot: "54"}
- {do: action, action: fuzzClick, move: drag_left, slots: "0,1,2"}
- {do: assertServer, path: events, since: "${mark}", type: InventoryDragEvent, field: "events[0].cancelled", value: true, timeout: 2000}Under a three-row menu, slot 54 is the first hotbar slot, so the bot picks up the stack it holds there and drags it over menu slots 0 to 2. Use empty slots of your own menu. Running scenarios on a server you start from a script, and in GitHub Actions, is covered in testing a Paper plugin with real bots.
Requirements and price
IgniteTestTool runs on Windows 10 or 11 with JDK 21, against Paper 1.21.4 to 1.21.11. It is 69.99 EUR a month, 150 EUR every three months, 300 EUR a year or 999.90 EUR once, from its own shop.
Where to go next
Written from
- Paper javadoc: InventoryAction
- Paper javadoc: ClickType
- Paper javadoc: InventoryClickEvent, never called for drags, unsafe methods
- Paper javadoc: InventoryDragEvent
- Paper javadoc: InventoryInteractEvent.setCancelled
- Paper javadoc: InventoryCloseEvent and its reasons
- Paper docs: custom InventoryHolders, names are unreliable
- Minecraft Wiki: Click Container packet, server resyncs slots
- Minecraft Wiki: inventory slot numbers per window
- IgniteTestTool wiki: GUI Fuzzer, Server Agent, Limitations