public class SlotChangeAction extends InventoryAction
| Modifier and Type | Field and Description |
|---|---|
protected Inventory |
inventory |
sourceItem, targetItem| Constructor and Description |
|---|
SlotChangeAction(Inventory inventory,
int inventorySlot,
Item sourceItem,
Item targetItem) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
execute(Player source)
Sets the item into the target inventory.
|
Inventory |
getInventory()
Returns the inventory involved in this action.
|
int |
getSlot()
Returns the inventorySlot in the inventory which this action modified.
|
boolean |
isValid(Player source)
Checks if the item in the inventory at the specified inventorySlot is the same as this action's source item.
|
void |
onAddToTransaction(InventoryTransaction transaction)
Called when the action is added to the specified InventoryTransaction.
|
void |
onExecuteFail(Player source)
Sends the original inventorySlot contents to the source player to revert the action.
|
void |
onExecuteSuccess(Player source)
Sends inventorySlot changes to other viewers of the inventory.
|
getCreationTime, getSourceItem, getTargetItem, onPreExecuteprotected Inventory inventory
public Inventory getInventory()
public int getSlot()
public boolean isValid(Player source)
isValid in class InventoryActionsource - playerpublic boolean execute(Player source)
execute in class InventoryActionsource - playerpublic void onExecuteSuccess(Player source)
onExecuteSuccess in class InventoryActionsource - playerpublic void onExecuteFail(Player source)
onExecuteFail in class InventoryActionsource - playerpublic void onAddToTransaction(InventoryTransaction transaction)
InventoryActiononAddToTransaction in class InventoryActiontransaction - to addCopyright © 2020. All rights reserved.