mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-31 22:22:49 +00:00
SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent
This commit is contained in:
parent
205213c618
commit
eec4aab001
1 changed files with 19 additions and 0 deletions
|
@ -1,10 +1,12 @@
|
|||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Called when a sheep's wool is dyed
|
||||
|
@ -13,11 +15,18 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable {
|
|||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancel;
|
||||
private DyeColor color;
|
||||
private final Player player;
|
||||
|
||||
@Deprecated
|
||||
public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color) {
|
||||
this(sheep, color, null);
|
||||
}
|
||||
|
||||
public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color, @Nullable Player player) {
|
||||
super(sheep);
|
||||
this.cancel = false;
|
||||
this.color = color;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,6 +45,16 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable {
|
|||
return (Sheep) entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the player dyeing the sheep, if available.
|
||||
*
|
||||
* @return player or null
|
||||
*/
|
||||
@Nullable
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the DyeColor the sheep is being dyed
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue