mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 22:14:40 +01:00
30 lines
1.3 KiB
Diff
30 lines
1.3 KiB
Diff
--- a/net/minecraft/server/ItemDye.java
|
|
+++ b/net/minecraft/server/ItemDye.java
|
|
@@ -3,6 +3,8 @@
|
|
import com.google.common.collect.Maps;
|
|
import java.util.Map;
|
|
|
|
+import org.bukkit.event.entity.SheepDyeWoolEvent; // CraftBukkit
|
|
+
|
|
public class ItemDye extends Item {
|
|
|
|
private static final Map<EnumColor, ItemDye> a = Maps.newEnumMap(EnumColor.class);
|
|
@@ -21,7 +23,17 @@
|
|
|
|
if (entitysheep.isAlive() && !entitysheep.isSheared() && entitysheep.getColor() != this.b) {
|
|
if (!entityhuman.world.isClientSide) {
|
|
- entitysheep.setColor(this.b);
|
|
+ // CraftBukkit start
|
|
+ byte bColor = (byte) this.b.getColorIndex();
|
|
+ SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData(bColor));
|
|
+ entitysheep.world.getServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ if (event.isCancelled()) {
|
|
+ return EnumInteractionResult.PASS;
|
|
+ }
|
|
+
|
|
+ entitysheep.setColor(EnumColor.fromColorIndex((byte) event.getColor().getWoolData()));
|
|
+ // CraftBukkit end
|
|
itemstack.subtract(1);
|
|
}
|
|
|