cn.nukkit.inventory.Inventory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powernukkit Show documentation
Show all versions of powernukkit Show documentation
A Minecraft Bedrock Edition server software implementation made in Java from scratch which supports all new features.
package cn.nukkit.inventory;
import cn.nukkit.Player;
import cn.nukkit.item.Item;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
/**
* @author MagicDroidX (Nukkit Project)
*/
public interface Inventory {
int MAX_STACK = 64;
int getSize();
int getMaxStackSize();
void setMaxStackSize(int size);
String getName();
String getTitle();
Item getItem(int index);
default boolean setItem(int index, Item item) {
return setItem(index, item, true);
}
boolean setItem(int index, Item item, boolean send);
Item[] addItem(Item... slots);
boolean canAddItem(Item item);
Item[] removeItem(Item... slots);
Map getContents();
void setContents(Map items);
void sendContents(Player player);
void sendContents(Player... players);
void sendContents(Collection players);
void sendSlot(int index, Player player);
void sendSlot(int index, Player... players);
void sendSlot(int index, Collection players);
boolean contains(Item item);
Map all(Item item);
default int first(Item item) {
return first(item, false);
}
int first(Item item, boolean exact);
int firstEmpty(Item item);
void decreaseCount(int slot);
void remove(Item item);
default boolean clear(int index) {
return clear(index, true);
}
boolean clear(int index, boolean send);
void clearAll();
boolean isFull();
boolean isEmpty();
Set getViewers();
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);
void addListener(InventoryListener listener);
void removeListener(InventoryListener listener);
}