Added PLAYER_ITEM_HELD event
This commit is contained in:
parent
c6d4cbda5d
commit
000d2a300f
@ -206,6 +206,13 @@ public abstract class Event {
|
|||||||
*/
|
*/
|
||||||
PLAYER_TELEPORT (Category.PLAYER),
|
PLAYER_TELEPORT (Category.PLAYER),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player changes their held item
|
||||||
|
*
|
||||||
|
* @see org.bukkit.event.player.PlayerItemHeldEvent
|
||||||
|
*/
|
||||||
|
PLAYER_ITEM_HELD (Category.PLAYER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BLOCK EVENTS
|
* BLOCK EVENTS
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
package org.bukkit.event.player;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fired when a player changes their currently held item
|
||||||
|
*/
|
||||||
|
public class PlayerItemHeldEvent extends PlayerEvent {
|
||||||
|
private int previous;
|
||||||
|
private int current;
|
||||||
|
|
||||||
|
public PlayerItemHeldEvent(final Type type, final Player player, final int previous, final int current) {
|
||||||
|
super(type, player);
|
||||||
|
this.previous = previous;
|
||||||
|
this.current = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the previous held slot index
|
||||||
|
*
|
||||||
|
* @return Previous slot index
|
||||||
|
*/
|
||||||
|
public int getPreviousSlot() {
|
||||||
|
return previous;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the new held slot index
|
||||||
|
*
|
||||||
|
* @return New slot index
|
||||||
|
*/
|
||||||
|
public int getNewSlot() {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
}
|
@ -97,4 +97,12 @@ public class PlayerListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
public void onInventoryOpen(PlayerInventoryEvent event) {
|
public void onInventoryOpen(PlayerInventoryEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player changes their held item
|
||||||
|
*
|
||||||
|
* @param event Relevant event details
|
||||||
|
*/
|
||||||
|
public void onItemHeldChange(PlayerItemHeldEvent event) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,6 +173,11 @@ public final class JavaPluginLoader implements PluginLoader {
|
|||||||
((PlayerListener)listener).onInventoryOpen( (PlayerInventoryEvent)event );
|
((PlayerListener)listener).onInventoryOpen( (PlayerInventoryEvent)event );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
case PLAYER_ITEM_HELD:
|
||||||
|
return new EventExecutor() { public void execute( Listener listener, Event event ) {
|
||||||
|
((PlayerListener)listener).onItemHeldChange( (PlayerItemHeldEvent)event );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Block Events
|
// Block Events
|
||||||
case BLOCK_PHYSICS:
|
case BLOCK_PHYSICS:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user