Updated inventories to a has-a relationship.

Added PlayerInventory interface with playeronly methods.
Add equals to ItemStack.
This commit is contained in:
Erik Broes
2011-01-09 18:21:31 +01:00
parent b1cab8c5ee
commit 9498644672
6 changed files with 237 additions and 50 deletions

View File

@@ -3,39 +3,25 @@ package org.bukkit;
/**
* Represents a slot in an inventory
*/
public class Slot {
private Inventory inventory;
private int index;
public Slot(Inventory inventory, int index) {
this.inventory = inventory;
this.index = index;
}
public interface Slot {
/**
* Gets the inventory this slot belongs to
*
* @return The inventory
*/
public Inventory getInventory() {
return inventory;
}
public Inventory getInventory();
/**
* Get the index this slot belongs to
*
* @return Index of the slot
*/
public int getIndex() {
return index;
}
public int getIndex();
/**
* Get the item from the slot.
*
* @return ItemStack in the slot.
*/
public ItemStack getItem() {
return inventory.getItem(index);
}
public ItemStack getItem();
}