mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 03:22:19 +01:00
#495: Expose ItemStack and hand used in PlayerShearEntityEvent
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
4d40a4b485
commit
01b8968e4b
1 changed files with 33 additions and 2 deletions
|
@ -1,9 +1,12 @@
|
||||||
package org.bukkit.event.player;
|
package org.bukkit.event.player;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,11 +16,19 @@ public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean cancel;
|
private boolean cancel;
|
||||||
private final Entity what;
|
private final Entity what;
|
||||||
|
private final ItemStack item;
|
||||||
|
private final EquipmentSlot hand;
|
||||||
|
|
||||||
public PlayerShearEntityEvent(@NotNull final Player who, @NotNull final Entity what) {
|
public PlayerShearEntityEvent(@NotNull Player who, @NotNull Entity what, @NotNull ItemStack item, @NotNull EquipmentSlot hand) {
|
||||||
super(who);
|
super(who);
|
||||||
this.cancel = false;
|
|
||||||
this.what = what;
|
this.what = what;
|
||||||
|
this.item = item;
|
||||||
|
this.hand = hand;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public PlayerShearEntityEvent(@NotNull final Player who, @NotNull final Entity what) {
|
||||||
|
this(who, what, new ItemStack(Material.SHEARS), EquipmentSlot.HAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,6 +51,26 @@ public class PlayerShearEntityEvent extends PlayerEvent implements Cancellable {
|
||||||
return what;
|
return what;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the item used to shear the entity.
|
||||||
|
*
|
||||||
|
* @return the shears
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public ItemStack getItem() {
|
||||||
|
return item.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the hand used to shear the entity.
|
||||||
|
*
|
||||||
|
* @return the hand
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public EquipmentSlot getHand() {
|
||||||
|
return hand;
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
|
|
Loading…
Reference in a new issue