SPIGOT-794: Call EntityPlaceEvent for Minecart placement

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2018-12-27 10:45:36 +11:00
parent d085b4781b
commit e7b5d8a7cf

View file

@ -58,11 +58,16 @@
return itemstack; return itemstack;
} }
@@ -84,7 +118,7 @@ @@ -84,7 +118,12 @@
entityminecartabstract.setCustomName(itemstack.getName()); entityminecartabstract.setCustomName(itemstack.getName());
} }
- world.addEntity(entityminecartabstract); - 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 + if (!world.addEntity(entityminecartabstract)) return EnumInteractionResult.PASS; // CraftBukkit
} }