2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/ItemDye.java
|
|
|
|
+++ b/net/minecraft/server/ItemDye.java
|
2018-07-15 02:00:00 +02:00
|
|
|
@@ -3,6 +3,8 @@
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
import java.util.Map;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.event.entity.SheepDyeWoolEvent; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class ItemDye extends Item {
|
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
private static final Map<EnumColor, ItemDye> a = Maps.newEnumMap(EnumColor.class);
|
|
|
|
@@ -19,7 +21,17 @@
|
|
|
|
EntitySheep entitysheep = (EntitySheep) entityliving;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
if (!entitysheep.isSheared() && entitysheep.getColor() != this.b) {
|
|
|
|
- entitysheep.setColor(this.b);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start
|
2018-07-15 02:00:00 +02:00
|
|
|
+ byte bColor = (byte) this.b.getColorIndex();
|
2016-11-17 02:41:03 +01:00
|
|
|
+ SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData(bColor));
|
2014-11-25 22:32:16 +01:00
|
|
|
+ entitysheep.world.getServer().getPluginManager().callEvent(event);
|
|
|
|
+
|
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
2018-07-15 02:00:00 +02:00
|
|
|
+ entitysheep.setColor(EnumColor.fromColorIndex((byte) event.getColor().getWoolData()));
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit end
|
2016-11-17 02:41:03 +01:00
|
|
|
itemstack.subtract(1);
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
2018-07-15 02:00:00 +02:00
|
|
|
|