public class SlotChangeAction extends InventoryAction
| Modifier and Type | Field and Description |
|---|---|
protected org.cloudburstmc.api.inventory.Inventory |
inventory |
sourceItem, targetItem| Constructor and Description |
|---|
SlotChangeAction(org.cloudburstmc.api.inventory.Inventory inventory,
int inventorySlot,
org.cloudburstmc.api.item.ItemStack sourceItem,
org.cloudburstmc.api.item.ItemStack targetItem) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
execute(CloudPlayer source)
Sets the item into the target inventory.
|
org.cloudburstmc.api.inventory.Inventory |
getInventory()
Returns the inventory involved in this action.
|
int |
getSlot()
Returns the inventorySlot in the inventory which this action modified.
|
boolean |
isValid(CloudPlayer 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(CloudPlayer source)
Sends the original inventorySlot contents to the source player to revert the action.
|
void |
onExecuteSuccess(CloudPlayer source)
Sends inventorySlot changes to other viewers of the inventory.
|
getCreationTime, getSourceItem, getTargetItem, onPreExecutepublic SlotChangeAction(org.cloudburstmc.api.inventory.Inventory inventory,
int inventorySlot,
org.cloudburstmc.api.item.ItemStack sourceItem,
org.cloudburstmc.api.item.ItemStack targetItem)
public org.cloudburstmc.api.inventory.Inventory getInventory()
public int getSlot()
public boolean isValid(CloudPlayer source)
isValid in class InventoryActionsource - playerpublic boolean execute(CloudPlayer source)
execute in class InventoryActionsource - playerpublic void onExecuteSuccess(CloudPlayer source)
onExecuteSuccess in class InventoryActionsource - playerpublic void onExecuteFail(CloudPlayer source)
onExecuteFail in class InventoryActionsource - playerpublic void onAddToTransaction(InventoryTransaction transaction)
InventoryActiononAddToTransaction in class InventoryActiontransaction - to addCopyright © 2021. All rights reserved.