public interface Inventory
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_STACK |
| Modifier and Type | Method and Description |
|---|---|
Item[] |
addItem(Item... slots) |
Map<Integer,Item> |
all(Item item) |
boolean |
canAddItem(Item item) |
default boolean |
clear(int index) |
boolean |
clear(int index,
boolean send) |
void |
clearAll() |
void |
close(Player who) |
boolean |
contains(Item item) |
void |
decreaseCount(int slot)
Decrease item count in the given slot
|
default int |
first(Item item) |
int |
first(Item item,
boolean exact)
Search for the first occurrence of target item
|
int |
firstEmpty()
Search for the first empty slot
|
default int |
firstFit(Item item) |
int |
firstFit(Item item,
boolean single)
Returns the first slot where item fits to
|
int |
firstNonEmpty()
Search for the first slot containing an item
|
Map<Integer,Item> |
getContents() |
int |
getFreeSpace(Item item)
Returns how much space remains for the target item
|
InventoryHolder |
getHolder() |
Item |
getItem(int index) |
int |
getMaxStackSize() |
String |
getName() |
int |
getSize() |
String |
getTitle() |
InventoryType |
getType() |
Set<Player> |
getViewers() |
void |
increaseCount(int slot)
Increase item count in the given slot
|
boolean |
isEmpty() |
boolean |
isFull() |
void |
onClose(Player who) |
void |
onOpen(Player who) |
void |
onSlotChange(int index,
Item before,
boolean send) |
boolean |
open(Player who) |
void |
remove(Item item) |
Item[] |
removeItem(Item... slots) |
void |
sendContents(Collection<Player> players) |
void |
sendContents(Player... players) |
void |
sendContents(Player player) |
void |
sendSlot(int index,
Collection<Player> players) |
void |
sendSlot(int index,
Player... players) |
void |
sendSlot(int index,
Player player) |
void |
setContents(Map<Integer,Item> items) |
default boolean |
setItem(int index,
Item item) |
boolean |
setItem(int index,
Item item,
boolean send) |
void |
setMaxStackSize(int size) |
static final int MAX_STACK
int getSize()
int getMaxStackSize()
void setMaxStackSize(int size)
String getName()
String getTitle()
Item getItem(int index)
default boolean setItem(int index,
Item item)
boolean setItem(int index,
Item item,
boolean send)
boolean canAddItem(Item item)
void sendContents(Player player)
void sendContents(Player... players)
void sendContents(Collection<Player> players)
void sendSlot(int index,
Player player)
void sendSlot(int index,
Player... players)
void sendSlot(int index,
Collection<Player> players)
boolean contains(Item item)
default int first(Item item)
int first(Item item, boolean exact)
item - target itemexact - if true the item count will be must matchdefault int firstFit(Item item)
int firstFit(Item item, boolean single)
item - item to search forsingle - if false the item count will be used. Otherwise it'll be 1int firstEmpty()
int firstNonEmpty()
int getFreeSpace(Item item)
item - target itemvoid decreaseCount(int slot)
slot - target slot indexvoid increaseCount(int slot)
slot - target slot indexvoid remove(Item item)
default boolean clear(int index)
boolean clear(int index,
boolean send)
void clearAll()
boolean isFull()
boolean isEmpty()
InventoryType getType()
InventoryHolder getHolder()
void onOpen(Player who)
boolean open(Player who)
void close(Player who)
void onClose(Player who)
void onSlotChange(int index,
Item before,
boolean send)
Copyright © 2020. All rights reserved.