SPIGOT-4352: MoistureChangeEvent

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2018-09-09 18:53:38 +10:00
parent 5b823ce70a
commit 5ac0aa1dbb
2 changed files with 28 additions and 1 deletions

View File

@@ -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);
}