diff options
author | Celtic Minstrel <celtic.minstrel.ca@some.place> | 2012-02-29 13:32:33 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-02-29 15:18:56 -0500 |
commit | 8a458ca2734dcccc03693844ab5e152d3ffc8d18 (patch) | |
tree | b70eaac0e020fe6188ab940bad22215f46eeab34 /src/test | |
parent | 0db822f6090d08ad12b26fdf5133ae53b6b91eb7 (diff) | |
download | bukkit-8a458ca2734dcccc03693844ab5e152d3ffc8d18.tar bukkit-8a458ca2734dcccc03693844ab5e152d3ffc8d18.tar.gz bukkit-8a458ca2734dcccc03693844ab5e152d3ffc8d18.tar.lz bukkit-8a458ca2734dcccc03693844ab5e152d3ffc8d18.tar.xz bukkit-8a458ca2734dcccc03693844ab5e152d3ffc8d18.zip |
[Bleeding] Inventory framework and events. Addresses BUKKIT-856
New events:
- InventoryOpenEvent
- InventoryClickEvent - detects any clicks on a slot or outside the window
- In the creative inventory view, only clicks on the quickbar are detected
- InventoryCloseEvent
- BrewEvent - when a potion finishes brewing
- CraftItemEvent (a subevent of InventoryClickEvent) - fired when taking the crafted item
- PrepareItemCraftEvent - fired just before updating the result slot
Changes to existing events:
- EnchantItemEvent extends InventoryEvent and also has a new whichButton() method
- PrepareItemEnchantEvent also extends InventoryEvent
- FurnaceBurnEvent and FurnaceSmeltEvent now extend BlockEvent (as does BrewEvent)
- PlayerInventoryEvent is deprecated (though it never did anything anyway)
New subclasses of Inventory:
- BrewerInventory
- CraftingInventory
- DoubleChestInventory
- EnchantingInventory
- FurnaceInventory
New methods in Inventory:
- getViewers()
- getTitle()
- getType()
- getHolder()
- iterator() - Yes, inventories are now iterable!
- The iterator is a ListIterator that does not support add or remove
New methods in Player:
- getOpenInventory()
- openInventory()
- openWorkbench()
- openEnchanting()
- closeInventory()
- setWindowProperty()
- getItemOnCursor()
- setItemOnCursor()
Other changes:
- createInventory() methods in Server to make inventories not linked to an object
- ContainerBlock is deprecated in favour of InventoryHolder
- New InventoryView class gives direct access to an inventory window!
- Removed the Slot class which did nothing and was used nowhere
Some small credit goes to Afforess (initial conception of openInventory() methods) and Drakia (initial conception of InventoryOpenEvent and InventoryCloseEvent).
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/bukkit/plugin/messaging/TestPlayer.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test/java/org/bukkit/plugin/messaging/TestPlayer.java b/src/test/java/org/bukkit/plugin/messaging/TestPlayer.java index e0ce019d..7cb648a1 100644 --- a/src/test/java/org/bukkit/plugin/messaging/TestPlayer.java +++ b/src/test/java/org/bukkit/plugin/messaging/TestPlayer.java @@ -19,6 +19,9 @@ import org.bukkit.entity.Snowball; import org.bukkit.entity.Vehicle; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.InventoryView.Property; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.map.MapView; @@ -679,4 +682,40 @@ public class TestPlayer implements Player { public <T> void playEffect(Location loc, Effect effect, T data) { throw new UnsupportedOperationException("Not supported yet."); } + + public InventoryView getOpenInventory() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public InventoryView openInventory(Inventory inventory) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public InventoryView openWorkbench(Location location, boolean force) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void openInventory(InventoryView inventory) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void closeInventory() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public InventoryView openEnchanting(Location location, boolean force) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public ItemStack getItemOnCursor() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setItemOnCursor(ItemStack item) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean setWindowProperty(Property prop, int value) { + throw new UnsupportedOperationException("Not supported yet."); + } } |