mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-23 19:16:40 +01:00
Block spawn eggs properly.
This commit is contained in:
parent
5e9ffe9e29
commit
e8cd1cc253
@ -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 <T extends Event & Cancellable> 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
|
||||
|
Loading…
Reference in New Issue
Block a user