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