diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index 3eb4a85b3..729c92cc1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -73,6 +73,7 @@ import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockDispenseEvent; import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockFormEvent; import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockGrowEvent; import org.bukkit.event.block.BlockIgniteEvent; @@ -833,6 +834,27 @@ public class PlayerEvents extends PlotListener implements Listener { } } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onBlockSpread(BlockFormEvent event) { + Block block = event.getBlock(); + Location location = BukkitUtil.getLocation(block.getLocation()); + if (location.isPlotRoad()) { + event.setCancelled(true); + return; + } + PlotArea area = location.getPlotArea(); + if (area == null) { + return; + } + Plot plot = area.getOwnedPlot(location); + if (plot == null) { + return; + } + if (Flags.SNOW_FORM.isFalse(plot)) { + event.setCancelled(true); + } + } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockDamage(BlockDamageEvent event) { Player player = event.getPlayer(); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/flag/Flags.java b/Core/src/main/java/com/intellectualcrafters/plot/flag/Flags.java index beb9b65f9..7df35cd50 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/flag/Flags.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/flag/Flags.java @@ -50,6 +50,7 @@ public final class Flags { public static final BooleanFlag DISABLE_PHYSICS = new BooleanFlag("disable-physics"); public static final BooleanFlag LIQUID_FLOW = new BooleanFlag("liquid-flow"); public static final BooleanFlag SNOW_MELT = new BooleanFlag("snow-melt"); + public static final BooleanFlag SNOW_FORM = new BooleanFlag("snow-form"); public static final BooleanFlag ICE_MELT = new BooleanFlag("ice-melt"); public static final BooleanFlag FIRE_SPREAD = new BooleanFlag("fire-spread"); public static final BooleanFlag BLOCK_BURN = new BooleanFlag("block-burn");