mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-17 05:41:26 +01:00
Added INVENTORY_OPEN as a player event
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
301b48abea
commit
63181e1c59
@ -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;
|
||||
}
|
||||
}
|
@ -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) {
|
||||
}
|
||||
}
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user