summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-09-09 18:53:38 +1000
committermd_5 <git@md-5.net>2018-09-09 18:56:38 +1000
commit3123a069bf04af331ae9194d223a7fd376535949 (patch)
tree0627ca46cd5e0dfe1b695de25a301f0c808b07c1 /src
parent226db0eae7bbaac7d7a14c4ddc608f5868e3731a (diff)
downloadcraftbukkit-3123a069bf04af331ae9194d223a7fd376535949.tar
craftbukkit-3123a069bf04af331ae9194d223a7fd376535949.tar.gz
craftbukkit-3123a069bf04af331ae9194d223a7fd376535949.tar.lz
craftbukkit-3123a069bf04af331ae9194d223a7fd376535949.tar.xz
craftbukkit-3123a069bf04af331ae9194d223a7fd376535949.zip
SPIGOT-4352: MoistureChangeEvent
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index daaf5037..c1acd202 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -373,6 +373,19 @@ public class CraftEventFactory {
return event;
}
+ public static boolean handleMoistureChangeEvent(World world, BlockPosition pos, IBlockData newBlock, int flag) {
+ CraftBlockState state = CraftBlockState.getBlockState(world, pos, flag);
+ state.setData(newBlock);
+
+ MoistureChangeEvent event = new MoistureChangeEvent(state.getBlock(), state);
+ Bukkit.getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ state.update(true);
+ }
+ return !event.isCancelled();
+ }
+
public static boolean handleBlockSpreadEvent(World world, BlockPosition source, BlockPosition target, IBlockData block) {
return handleBlockSpreadEvent(world, source, target, block, 2);
}