1package com.runehive.game.world.items.containers.inventory;
3import com.runehive.game.world.entity.mob.player.Player;
4import com.runehive.game.world.items.Item;
5import com.runehive.game.world.items.containers.ItemContainer;
6import com.runehive.game.world.items.containers.ItemContainerAdapter;
7import com.runehive.game.world.items.ground.GroundItem;
8import com.runehive.net.packet.out.SendItemOnInterface;
9import com.runehive.net.packet.out.SendItemOnInterfaceSlot;
10import com.runehive.net.packet.out.SendMessage;
12import java.util.Arrays;
14import java.util.Optional;
15import java.util.function.Consumer;
26 public static final int SIZE = 28;
58 player.inventory.add(item);
135 addOrExecute(t ->
player.bank.depositFromNothing(t, 0),
"@red@Some of the items were banked since you have no room in your inventory.",
items);
176 return "You do not have enough space in your inventory.";
This class represents a character controlled by a player.
The container class that represents an item that can be interacted with.
ItemContainerAdapter(Player player)
Creates a new ItemContainerAdapter.
final Player player
The Player instance.
ItemContainer(int capacity, StackPolicy policy, Item[] items)
Creates a new ItemContainer.
Item[] items
The Items within this container.
final boolean hasCapacityFor(Item... item)
Determines if this container has the capacity for item.
final boolean addListener(ItemContainerListener listener)
Adds an ItemContainerListener to this container.
final Item[] toArray()
Returns a shallow copy of the backing array.
An ItemContainerAdapter implementation that listens for changes to the inventory.
InventoryListener(Player player)
Creates a new InventoryListener.
void itemUpdated(ItemContainer container, Optional< Item > oldItem, Optional< Item > newItem, int index, boolean refresh, boolean login)
Fired when an Item is added, removed, or replaced.
String getCapacityExceededMsg()
void addOrExecute(Consumer< Item > action, Item... items)
Attempts to deposit the items to the inventory, if inventory is full it'll execute the action for the...
void addOrDrop(Item... items)
Attempts to deposit an item to the players inventory, if there is no space it'll bank the item instea...
final Player player
The player instance for which this inventory applies to.
void addOrBank(List< Item > items)
Attempts to deposit an item to the players inventory, if there is no space it'll bank the item instea...
static final int SIZE
The size of all equipment instances.
Inventory(Player player)
Creates a new Inventory.
void refresh()
Refreshes the players inventory.
void addOrExecute(Consumer< Item > action, String message, List< Item > items)
Attempts to deposit the items to the inventory, if inventory is full it'll execute the action for the...
void addOrDrop(List< Item > items)
Attempts to deposit an item to the players inventory, if there is no space it'll bank the item instea...
void addOrBank(Item... items)
Attempts to deposit an item to the players inventory, if there is no space it'll bank the item instea...
void addOrExecute(Consumer< Item > action, String message, Item... items)
Attempts to deposit the items to the inventory, if inventory is full it'll execute the action for the...
void addOrExecute(Consumer< Item > action, Optional< String > message, Item... items)
Attempts to deposit the items to the inventory, if inventory is full it'll execute the action for the...
static final int INVENTORY_DISPLAY_ID
The inventory item display widget identifier.
void addOrExecute(Consumer< Item > action, Optional< String > message, List< Item > items)
Attempts to deposit the items to the inventory, if inventory is full it'll execute the action for the...
void addOrExecute(Consumer< Item > action, List< Item > items)
Attempts to deposit the items to the inventory, if inventory is full it'll execute the action for the...
void refresh(Player player, int widget)
Refreshes the inventory container.
Represents a single Ground item on the world map.
static GroundItem create(Player player, Item item)
Creates a new GroundItem object for a player and an item.
The OutgoingPacket that sends a message to a Players chatbox in the client.
An enumerated type defining policies for stackable Items.
STANDARD
The STANDARD policy, items are only stacked if they are defined as stackable in their ItemDefinition ...