Skip to content

Instantly share code, notes, and snippets.

@grum
Created January 3, 2011 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grum/764139 to your computer and use it in GitHub Desktop.
Save grum/764139 to your computer and use it in GitHub Desktop.
package org.bukkit;
import java.io.ObjectInputStream.GetField;
/**
* Represents the inventory
* @author Grum
*/
public interface Inventory {
/**
* Gets the name of the inventory
*
* @return The name of the inventory
*/
public String getName();
/**
* Set the name of the inventory
*
* @param name The new name of the inventory
*/
public void setName(String name);
/**
* Get the size of the inventory
*
* @return The size of the inventory
*/
public int getSize();
/**
* Get the index of the first emtpy slot
*
* @return The index of the first empty slot
*/
public int getFirstEmptySlot();
/**
* Get the contents of the inventory
*
* @return The contents of the inventory
*/
public ItemStack[] getContents();
/**
* Set the contents of the inventory. Make sure you pass in an
* array matching the size returned by {@link Inventory#getSize()}.
*
* @param contents New contents for the inventory.
*/
public void setContents(ItemStack[] contents);
/**
* Get the ItemStack at the given slot, can return null!
*
* @param slot The slot to return
* @return The ItemStack found (can be null!)
*/
public ItemStack getItem(int slot);
/**
* Get the ItemStack at the given slot, but take a maximum amount
* of maxAmount splitting the stack if needed. This can return null!
*
* @param slot The ItemStack to return
* @return The ItemStack found (can be null!)
*/
public ItemStack getItem(int slot, int maxAmount);
/**
* Set a slot to contain the given ItemStack.
*
* @param slot The slot to fill
* @param item The ItemStack to put into the slot
* @return
*/
public ItemStack setItem(int slot, ItemStack item);
/**
* Add the given ItemStack to the first available spot
*
* @param item The ItemStack to store
*/
public void addItem(ItemStack item);
/**
* Wipe out the slot at the given index
*
* @param slot Index to wipe out
*/
public void clearItem(int slot);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment