diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-01-30 22:05:36 +0000 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-01-30 22:06:17 +0000 |
commit | 99bc01b602dd884a1d51d8f21e02add810f82d82 (patch) | |
tree | 9aa5790c9b54c4d751e0a9b7f3afa57fb069647b /src | |
parent | 9831f3960dbe56021e4b7e212b9593af7d25210a (diff) | |
download | bukkit-99bc01b602dd884a1d51d8f21e02add810f82d82.tar bukkit-99bc01b602dd884a1d51d8f21e02add810f82d82.tar.gz bukkit-99bc01b602dd884a1d51d8f21e02add810f82d82.tar.lz bukkit-99bc01b602dd884a1d51d8f21e02add810f82d82.tar.xz bukkit-99bc01b602dd884a1d51d8f21e02add810f82d82.zip |
Added INVENTORY_OPEN as a player event
Diffstat (limited to 'src')
3 files changed, 40 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/player/PlayerInventoryEvent.java b/src/main/java/org/bukkit/event/player/PlayerInventoryEvent.java new file mode 100644 index 00000000..7c6489a2 --- /dev/null +++ b/src/main/java/org/bukkit/event/player/PlayerInventoryEvent.java @@ -0,0 +1,26 @@ + +package org.bukkit.event.player; + +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; + +/** + * Represents a player related inventory event + */ +public class PlayerInventoryEvent extends PlayerEvent { + protected Inventory inventory; + + public PlayerInventoryEvent(final Type type, final Player player, final Inventory inventory) { + super(type, player); + this.inventory = inventory; + } + + /** + * Gets the Inventory involved in this event + * + * @return Inventory + */ + public Inventory getInventory() { + return inventory; + } +} diff --git a/src/main/java/org/bukkit/event/player/PlayerListener.java b/src/main/java/org/bukkit/event/player/PlayerListener.java index 2739f6fd..79bc30ca 100644 --- a/src/main/java/org/bukkit/event/player/PlayerListener.java +++ b/src/main/java/org/bukkit/event/player/PlayerListener.java @@ -89,4 +89,12 @@ public class PlayerListener implements Listener { */ public void onPlayerAnimation(PlayerAnimationEvent event) { } + + /** + * Called when a player opens an inventory + * + * @param event Relevant event details + */ + public void onInventoryOpen(PlayerInventoryEvent event) { + } } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java index 0650584b..e34b92a0 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -24,6 +24,7 @@ import org.bukkit.event.vehicle.*; import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.event.world.WorldListener; +import org.bukkit.inventory.PlayerInventory; import org.bukkit.plugin.*; /** @@ -167,6 +168,11 @@ public final class JavaPluginLoader implements PluginLoader { ((PlayerListener)listener).onPlayerAnimation( (PlayerAnimationEvent)event ); } }; + case INVENTORY_OPEN: + return new EventExecutor() { public void execute( Listener listener, Event event ) { + ((PlayerListener)listener).onInventoryOpen( (PlayerInventoryEvent)event ); + } + }; // Block Events case BLOCK_PHYSICS: |