cn.nukkit.inventory.Inventory Java Examples

The following examples show how to use cn.nukkit.inventory.Inventory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InventoryTransaction.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
protected void sendInventories() {
    for (Inventory inventory : this.inventories) {
        inventory.sendContents(this.source);
        if (inventory instanceof PlayerInventory) {
            ((PlayerInventory) inventory).sendArmorContents(this.source);
        }
    }
}
 
Example #2
Source File: InventoryClickEvent.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public InventoryClickEvent(Player who, Inventory inventory, int slot, Item sourceItem, Item heldItem) {
    super(inventory);
    this.slot = slot;
    this.sourceItem = sourceItem;
    this.heldItem = heldItem;
    this.player = who;
}
 
Example #3
Source File: InventoryClickEvent.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public InventoryClickEvent(Player who, Inventory inventory, int slot, Item sourceItem, Item heldItem) {
    super(inventory);
    this.slot = slot;
    this.sourceItem = sourceItem;
    this.heldItem = heldItem;
    this.player = who;
}
 
Example #4
Source File: InventoryTransaction.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
protected void sendInventories() {
    for (Inventory inventory : this.inventories) {
        inventory.sendContents(this.source);
        if (inventory instanceof PlayerInventory) {
            ((PlayerInventory) inventory).sendArmorContents(this.source);
        }
    }
}
 
Example #5
Source File: EntityInventoryChangeEvent.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
public EntityInventoryChangeEvent(Entity entity, Inventory inventory, Item oldItem, Item newItem, int slot) {
    this.entity = entity;
    this.inventory = inventory;
    this.oldItem = oldItem;
    this.newItem = newItem;
    this.slot = slot;
}
 
Example #6
Source File: InventoryMoveItemEvent.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public InventoryMoveItemEvent(Inventory from, Inventory targetInventory, InventoryHolder source, Item item, Action action) {
    super(from);
    this.targetInventory = targetInventory;
    this.source = source;
    this.item = item;
    this.action = action;
}
 
Example #7
Source File: InventoryClickEvent.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
public InventoryClickEvent(Inventory inventory, int slot, Item sourceItem, Item heldItem, Item leftItem) {
    super(inventory);
    this.slot = slot;
    this.sourceItem = sourceItem;
    this.heldItem = heldItem;
    this.leftItem = leftItem;
}
 
Example #8
Source File: InventoryTransaction.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public Set<Inventory> getInventories() {
    return inventories;
}
 
Example #9
Source File: SlotChangeAction.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public SlotChangeAction(Inventory inventory, int inventorySlot, Item sourceItem, Item targetItem) {
    super(sourceItem, targetItem);
    this.inventory = inventory;
    this.inventorySlot = inventorySlot;
}
 
Example #10
Source File: InventoryEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public InventoryEvent(Inventory inventory) {
    this.inventory = inventory;
}
 
Example #11
Source File: InventoryEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public Inventory getInventory() {
    return inventory;
}
 
Example #12
Source File: InventoryPickupItemEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public InventoryPickupItemEvent(Inventory inventory, EntityItem item) {
    super(inventory);
    this.item = item;
}
 
Example #13
Source File: InventoryCloseEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public InventoryCloseEvent(Inventory inventory, Player who) {
    super(inventory);
    this.who = who;
}
 
Example #14
Source File: InventoryOpenEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public InventoryOpenEvent(Inventory inventory, Player who) {
    super(inventory);
    this.who = who;
}
 
Example #15
Source File: InventoryPickupArrowEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public InventoryPickupArrowEvent(Inventory inventory, EntityArrow arrow) {
    super(inventory);
    this.arrow = arrow;
}
 
Example #16
Source File: InventoryMoveItemEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public Inventory getTargetInventory() {
    return targetInventory;
}
 
Example #17
Source File: SimpleInventoryTransaction.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Set<Inventory> getInventories() {
    return inventories;
}
 
Example #18
Source File: InventoryTransaction.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
/**
 * This method should not be used by plugins, it's used to add tracked inventories for InventoryActions
 * involving inventories.
 */
public void addInventory(Inventory inventory) {
    if (!this.inventories.contains(inventory)) {
        this.inventories.add(inventory);
    }
}
 
Example #19
Source File: SlotChangeAction.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public SlotChangeAction(Inventory inventory, int inventorySlot, Item sourceItem, Item targetItem) {
    super(sourceItem, targetItem);
    this.inventory = inventory;
    this.inventorySlot = inventorySlot;
}
 
Example #20
Source File: SlotChangeAction.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns the inventory involved in this action.
 */
public Inventory getInventory() {
    return this.inventory;
}
 
Example #21
Source File: InventoryEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public InventoryEvent(Inventory inventory) {
    this.inventory = inventory;
}
 
Example #22
Source File: InventoryEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public Inventory getInventory() {
    return inventory;
}
 
Example #23
Source File: InventoryPickupItemEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public InventoryPickupItemEvent(Inventory inventory, EntityItem item) {
    super(inventory);
    this.item = item;
}
 
Example #24
Source File: InventoryCloseEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public InventoryCloseEvent(Inventory inventory, Player who) {
    super(inventory);
    this.who = who;
}
 
Example #25
Source File: InventoryOpenEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public InventoryOpenEvent(Inventory inventory, Player who) {
    super(inventory);
    this.who = who;
}
 
Example #26
Source File: InventoryPickupArrowEvent.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public InventoryPickupArrowEvent(Inventory inventory, EntityArrow arrow) {
    super(inventory);
    this.arrow = arrow;
}
 
Example #27
Source File: EntityInventoryChangeEvent.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public Inventory getInventory() {
    return inventory;
}
 
Example #28
Source File: EntityVillager.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Inventory getInventory() {
    return new TradingInventory(this);
}
 
Example #29
Source File: AnvilTransaction.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Set<Inventory> getInventories() {
    return inventories;
}
 
Example #30
Source File: EnchantInputAction.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public EnchantInputAction(Inventory inventory, Item sourceItem, Item targetItem) {
    super(sourceItem, targetItem);
    this.inventory = inventory;
}