mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-20 14:08:57 +01:00
Add BlockShearEntityEvent for Dispensers shearing Sheep
By: nathat890 <nathat890@outlook.com>
This commit is contained in:
parent
7285d5d822
commit
a3e5b8bdf0
1 changed files with 67 additions and 0 deletions
|
@ -0,0 +1,67 @@
|
||||||
|
package org.bukkit.event.block;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event fired when a dispenser shears a nearby sheep.
|
||||||
|
*/
|
||||||
|
public class BlockShearEntityEvent extends BlockEvent implements Cancellable {
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
//
|
||||||
|
private final Entity sheared;
|
||||||
|
private final ItemStack tool;
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
public BlockShearEntityEvent(@NotNull Block dispenser, @NotNull Entity sheared, @NotNull ItemStack tool) {
|
||||||
|
super(dispenser);
|
||||||
|
this.sheared = sheared;
|
||||||
|
this.tool = tool;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the entity that was sheared.
|
||||||
|
*
|
||||||
|
* @return the entity that was sheared.
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public Entity getEntity() {
|
||||||
|
return sheared;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the item used to shear this sheep.
|
||||||
|
*
|
||||||
|
* @return the item used to shear this sheep.
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public ItemStack getTool() {
|
||||||
|
return tool.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancelled) {
|
||||||
|
this.cancelled = cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue