--- a/net/minecraft/world/item/ItemDye.java +++ b/net/minecraft/world/item/ItemDye.java @@ -8,6 +8,8 @@ import net.minecraft.world.entity.animal.EntitySheep; import net.minecraft.world.entity.player.EntityHuman; +import org.bukkit.event.entity.SheepDyeWoolEvent; // CraftBukkit + public class ItemDye extends Item { private static final Map a = Maps.newEnumMap(EnumColor.class); @@ -26,7 +28,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); }