public class InventoryTransaction extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Set<InventoryAction> |
actions |
protected boolean |
hasExecuted |
protected Set<Inventory> |
inventories |
protected Player |
source |
| Constructor and Description |
|---|
InventoryTransaction(Player source,
List<InventoryAction> actions) |
InventoryTransaction(Player source,
List<InventoryAction> actions,
boolean init) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAction(InventoryAction action) |
void |
addInventory(Inventory inventory)
This method should not be used by plugins, it's used to add tracked inventories for InventoryActions
involving inventories.
|
protected boolean |
callExecuteEvent() |
boolean |
canExecute() |
boolean |
execute() |
Set<InventoryAction> |
getActions() |
long |
getCreationTime() |
Set<Inventory> |
getInventories() |
Player |
getSource() |
boolean |
hasExecuted() |
protected void |
init(Player source,
List<InventoryAction> actions) |
protected boolean |
matchItems(List<Item> needItems,
List<Item> haveItems) |
protected void |
sendInventories() |
protected boolean |
squashDuplicateSlotChanges()
Iterates over SlotChangeActions in this transaction and compacts any which refer to the same inventorySlot in the same
inventory so they can be correctly handled.
|
protected boolean hasExecuted
protected Player source
protected Set<InventoryAction> actions
public InventoryTransaction(Player source, List<InventoryAction> actions)
public InventoryTransaction(Player source, List<InventoryAction> actions, boolean init)
protected void init(Player source, List<InventoryAction> actions)
public Player getSource()
public long getCreationTime()
public Set<InventoryAction> getActions()
public void addAction(InventoryAction action)
public void addInventory(Inventory inventory)
inventory - to addprotected void sendInventories()
protected boolean squashDuplicateSlotChanges()
Under normal circumstances, the same inventorySlot would never be changed more than once in a single transaction. However, due to the way things like the crafting grid are "implemented" in MCPE 1.2 (a.k.a. hacked-in), we may get multiple inventorySlot changes referring to the same inventorySlot in a single transaction. These multiples are not even guaranteed to be in the correct order (inventorySlot splitting in the crafting grid for example, causes the actions to be sent in the wrong order), so this method also tries to chain them into order.
public boolean canExecute()
protected boolean callExecuteEvent()
public boolean execute()
public boolean hasExecuted()
Copyright © 2020. All rights reserved.