Class PrepareHopperTransferEvent
java.lang.Object
org.bukkit.event.Event
io.papermc.paper.event.inventory.PrepareHopperTransferEvent
Called when a hopper or hopper minecart is about to choose an item to move,
before any
InventoryMoveItemEvent.
The hopper treats disallowed slots of the source as if they do not exist, so a source with items only in disallowed slots is treated as empty.
-
Nested Class Summary
Nested classes/interfaces inherited from class Event
Event.Result -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPrepareHopperTransferEvent(Inventory source, Inventory destination, boolean didSourceInitiate) -
Method Summary
Modifier and TypeMethodDescriptionGets the Inventory that items are being put intostatic HandlerListGets the Inventory that initiated the transfer.Gets the Inventory that items are being taken frombooleanisSlotAllowed(int slot) Gets if the hopper is allowed to take items from a slot ofgetSource().voidsetSlotAllowed(int slot, boolean allowed) Sets if the hopper is allowed to take items from a slot ofgetSource().Methods inherited from class Event
callEvent, getEventName, isAsynchronous
-
Field Details
-
disallowedSlots
protected long disallowedSlots
-
-
Constructor Details
-
PrepareHopperTransferEvent
-
-
Method Details
-
getSource
Gets the Inventory that items are being taken from- Returns:
- Inventory that items are being taken from
-
getDestination
Gets the Inventory that items are being put into- Returns:
- Inventory that items are being put into
-
getInitiator
Gets the Inventory that initiated the transfer. This will always be either the destination or source Inventory.- Returns:
- Inventory that initiated the transfer
-
isSlotAllowed
public boolean isSlotAllowed(int slot) Gets if the hopper is allowed to take items from a slot ofgetSource().- Parameters:
slot- the slot- Returns:
- true if the slot is allowed
-
setSlotAllowed
public void setSlotAllowed(int slot, boolean allowed) Sets if the hopper is allowed to take items from a slot ofgetSource().- Parameters:
slot- the slotallowed- whether the slot is allowed
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-