Pumpkin-MC/Pumpkin · warning · InventoryError
Multiple players dragging in a container at once
Error message
Multiple players dragging in a container at once
What it means
InventoryError::MultiplePlayersDragging is returned when multiple players attempt to perform a drag-style item distribution in the same container at the same time. Drag interactions are stateful (a drag must span start/middle/end packets), so the library forbids interleaved drags from different players to keep distributions consistent.
Solutions
- Reject the second drag with this error and require the client to restart its drag
- Add a timeout that clears stale drag state so a missing End packet cannot block future drags
- Serialize drag handling per container and cancel the first drag when a second player initiates one
- Log which player IDs conflicted to spot abusive clients
Example fix
// before
container.handle_drag(player_id, drag)?;
// after
match container.handle_drag(player_id, drag) {
Err(InventoryError::MultiplePlayersDragging) => {
player.send_message("Another player is dragging items; try again.");
}
r => r?,
} Defensive patterns
Strategy: try-catch
Validate before calling
fn drag_allowed(container: &Container, player_id: i32) -> bool {
match container.active_drag() {
None => true,
Some(d) => d.player_id == player_id,
}
} Try / catch
match container.handle_drag(player_id, drag) {
Err(InventoryError::MultiplePlayersDragging) => {
player.send_message("Another player is dragging; try again shortly.");
}
r => r?,
} Prevention
- Add a timeout that clears stale drag state when an End packet never arrives
- Serialize drag handling per container and reject interleaved drags early
- Track the dragging player ID so the same player can continue its own drag
- Log conflicting player IDs to identify abusive or broken clients
When it happens
Trigger: Two players sending Drag-packet sequences (left/medium/right drag) targeting the same open container concurrently; a second drag starting before the first player's drag completes with its End packet.
Common situations: Busy public chests where several players drag-split stacks simultaneously; clients that abort drags without sending the End packet, leaving drag state stuck.
Related errors
- Out of order dragging
- Unable to lock
- Invalid slot
- Player ' ' tried to interact with a closed container
- Invalid inventory packet
AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09).
Data as JSON: /api/errors/88db2ac53e81ee56.
Report an issue: GitHub.
Appendix: source
Thrown at crates/pumpkin-inventory/src/error.rs:21
/// Errors that can occur during inventory operations.
///
/// These errors represent various failure conditions when handling inventory
/// interactions, such as invalid slot indices, permission issues, or protocol errors.
#[derive(Error, Debug)]
pub enum InventoryError {
/// Failed to acquire a lock on an inventory or slot.
#[error("Unable to lock")]
LockError,
/// The specified slot index is invalid or out of bounds.
#[error("Invalid slot")]
InvalidSlot,
/// A player attempted to interact with a container that is closed.
///
/// The parameter is the player's entity ID.
#[error("Player '{0}' tried to interact with a closed container")]
ClosedContainerInteract(i32),
/// Multiple players attempted to drag items in the same container simultaneously.
#[error("Multiple players dragging in a container at once")]
MultiplePlayersDragging,
/// Drag operation was performed out of order (e.g., end before start).
#[error("Out of order dragging")]
OutOfOrderDragging,
/// The received inventory packet is malformed or invalid.
#[error("Invalid inventory packet")]
InvalidPacket,
/// The player lacks permission to perform this inventory operation.
#[error("Player does not have enough permissions")]
PermissionError,
}
View on GitHub (pinned to 8d4639e25a)