mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-31 22:22:49 +00:00
Add PlayerChangedMainHandEvent
This commit is contained in:
parent
b276e93f56
commit
7c7228c87a
2 changed files with 40 additions and 1 deletions
|
@ -38,7 +38,7 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, Permissible, Inv
|
||||||
public Inventory getEnderChest();
|
public Inventory getEnderChest();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the players selected main hand
|
* Gets the player's selected main hand
|
||||||
*
|
*
|
||||||
* @return the players main hand
|
* @return the players main hand
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package org.bukkit.event.player;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.inventory.MainHand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a player changes their main hand in the client settings.
|
||||||
|
*/
|
||||||
|
public class PlayerChangedMainHandEvent extends PlayerEvent {
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
//
|
||||||
|
private final MainHand mainHand;
|
||||||
|
|
||||||
|
public PlayerChangedMainHandEvent(Player who, MainHand mainHand) {
|
||||||
|
super(who);
|
||||||
|
this.mainHand = mainHand;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the new main hand of the player. The old hand is still momentarily
|
||||||
|
* available via {@link Player#getMainHand()}.
|
||||||
|
*
|
||||||
|
* @return the new {@link MainHand} of the player
|
||||||
|
*/
|
||||||
|
public MainHand getMainHand() {
|
||||||
|
return mainHand;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue