summaryrefslogtreecommitdiffstats
path: root/nms-patches/FluidTypeFlowing.patch
blob: 32ce4ece72fde15bafbaa0da5dd2178da8eb8735 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--- a/net/minecraft/server/FluidTypeFlowing.java
+++ b/net/minecraft/server/FluidTypeFlowing.java
@@ -5,6 +5,11 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Map.Entry;
+// CraftBukkit start
+import org.bukkit.block.BlockFace;
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.event.block.BlockFromToEvent;
+// CraftBukkit end
 
 public abstract class FluidTypeFlowing extends FluidType {
 
@@ -128,6 +133,15 @@
             Fluid fluid1 = this.a((IWorldReader) generatoraccess, blockposition1, iblockdata1);
 
             if (this.a(generatoraccess, blockposition, iblockdata, EnumDirection.DOWN, blockposition1, iblockdata1, generatoraccess.b(blockposition1), fluid1.c())) {
+                // CraftBukkit start
+                org.bukkit.block.Block source = CraftBlock.at(generatoraccess, blockposition);
+                BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
+                generatoraccess.getMinecraftWorld().getServer().getPluginManager().callEvent(event);
+
+                if (event.isCancelled()) {
+                    return;
+                }
+                // CraftBukkit end
                 this.a(generatoraccess, blockposition1, iblockdata1, EnumDirection.DOWN, fluid1);
                 if (this.a((IWorldReader) generatoraccess, blockposition) >= 3) {
                     this.a(generatoraccess, blockposition, fluid, iblockdata);
@@ -158,6 +172,15 @@
                 IBlockData iblockdata1 = generatoraccess.getType(blockposition1);
 
                 if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.b(blockposition1), fluid1.c())) {
+                    // CraftBukkit start
+                    org.bukkit.block.Block source = CraftBlock.at(generatoraccess, blockposition);
+                    BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection));
+                    generatoraccess.getMinecraftWorld().getServer().getPluginManager().callEvent(event);
+
+                    if (event.isCancelled()) {
+                        continue;
+                    }
+                    // CraftBukkit end
                     this.a(generatoraccess, blockposition1, iblockdata1, enumdirection, fluid1);
                 }
             }