mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-31 21:37:39 +01:00
SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent
By: md_5 <git@md-5.net>
This commit is contained in:
parent
ba6c523bf3
commit
2e77f4180e
@ -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…
Reference in New Issue
Block a user