Commits

md_5 authored 325dae0d06b
SPIGOT-1608: Add a way to get the hand used in PlayerInteract*Events
No tags

src/main/java/org/bukkit/event/player/PlayerInteractAtEntityEvent.java

Modified
1 1 package org.bukkit.event.player;
2 2
3 3 import org.bukkit.entity.Entity;
4 4 import org.bukkit.entity.Player;
5 5 import org.bukkit.event.HandlerList;
6 +import org.bukkit.inventory.EquipmentSlot;
6 7 import org.bukkit.util.Vector;
7 8
8 9 /**
9 10 * Represents an event that is called when a player right clicks an entity
10 11 * with a location on the entity the was clicked.
11 12 */
12 13 public class PlayerInteractAtEntityEvent extends PlayerInteractEntityEvent {
13 14 private static final HandlerList handlers = new HandlerList();
14 15 private final Vector position;
15 16
16 17 public PlayerInteractAtEntityEvent(Player who, Entity clickedEntity, Vector position) {
17 - super(who, clickedEntity);
18 + this(who, clickedEntity, position, EquipmentSlot.HAND);
19 + }
20 +
21 + public PlayerInteractAtEntityEvent(Player who, Entity clickedEntity, Vector position, EquipmentSlot hand) {
22 + super(who, clickedEntity, hand);
18 23 this.position = position;
19 24 }
20 -
25 +
21 26 public Vector getClickedPosition() {
22 27 return position.clone();
23 28 }
24 29
25 30 @Override
26 31 public HandlerList getHandlers() {
27 32 return handlers;
28 33 }
29 34
30 35 public static HandlerList getHandlerList() {

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut