summaryrefslogtreecommitdiffstats
path: root/nms-patches/ItemBoat.patch
blob: daeabd5edb8e33cf56d29b976668864f2cb58b5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
--- a/net/minecraft/server/ItemBoat.java
+++ b/net/minecraft/server/ItemBoat.java
@@ -55,6 +55,13 @@
             } else if (movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.BLOCK) {
                 return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
             } else {
+                // CraftBukkit start - Boat placement
+                org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, movingobjectposition.a(), movingobjectposition.direction, itemstack);
+
+                if (event.isCancelled()) {
+                    return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack);
+                }
+                // CraftBukkit end
                 Block block = world.getType(movingobjectposition.a()).getBlock();
                 boolean flag1 = block == Blocks.WATER || block == Blocks.FLOWING_WATER;
                 EntityBoat entityboat = new EntityBoat(world, movingobjectposition.pos.x, flag1 ? movingobjectposition.pos.y - 0.12D : movingobjectposition.pos.y, movingobjectposition.pos.z);