mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 02:22:12 +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 changed files with 19 additions and 0 deletions
|
@ -1,10 +1,12 @@
|
||||||
package org.bukkit.event.entity;
|
package org.bukkit.event.entity;
|
||||||
|
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Sheep;
|
import org.bukkit.entity.Sheep;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a sheep's wool is dyed
|
* 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 static final HandlerList handlers = new HandlerList();
|
||||||
private boolean cancel;
|
private boolean cancel;
|
||||||
private DyeColor color;
|
private DyeColor color;
|
||||||
|
private final Player player;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public SheepDyeWoolEvent(@NotNull final Sheep sheep, @NotNull final DyeColor color) {
|
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);
|
super(sheep);
|
||||||
this.cancel = false;
|
this.cancel = false;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -36,6 +45,16 @@ public class SheepDyeWoolEvent extends EntityEvent implements Cancellable {
|
||||||
return (Sheep) entity;
|
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
|
* Gets the DyeColor the sheep is being dyed
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue