diff --git a/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java b/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java index ff096467..e45bb53d 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java @@ -105,6 +105,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.material.Dispenser; import org.bukkit.material.MaterialData; +import org.bukkit.material.SpawnEgg; import org.bukkit.util.Vector; import javax.annotation.Nullable; @@ -738,6 +739,14 @@ private static void handleBlockRightClick(T even Events.fireToCancel(event, new SpawnEntityEvent(event, cause, placed.getLocation().add(0.5, 0, 0.5), EntityType.MINECART)); } + // Handle created spawn eggs + if (item != null && item.getType() == Material.MONSTER_EGG) { + MaterialData data = item.getData(); + if (data instanceof SpawnEgg) { + Events.fireToCancel(event, new SpawnEntityEvent(event, cause, placed.getLocation().add(0.5, 0, 0.5), ((SpawnEgg) data).getSpawnedType())); + } + } + // Handle cocoa beans if (item != null && item.getType() == Material.INK_SACK && Materials.isDyeColor(item.getData(), DyeColor.BROWN)) { // CraftBukkit doesn't or didn't throw a clicked place for this