SPIGOT-794: Call EntityPlaceEvent for Minecart placement

This commit is contained in:
md_5 2018-12-27 10:45:36 +11:00
parent 2b2d084ac9
commit 0afed59271

View File

@ -58,11 +58,16 @@
return itemstack;
}
@@ -84,7 +118,7 @@
@@ -84,7 +118,12 @@
entityminecartabstract.setCustomName(itemstack.getName());
}
- world.addEntity(entityminecartabstract);
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(itemactioncontext, entityminecartabstract).isCancelled()) {
+ return EnumInteractionResult.FAIL;
+ }
+ // CraftBukkit end
+ if (!world.addEntity(entityminecartabstract)) return EnumInteractionResult.PASS; // CraftBukkit
}