diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/BukkitWorldConfiguration.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/BukkitWorldConfiguration.java index 0f29943d..936f9803 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/BukkitWorldConfiguration.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/BukkitWorldConfiguration.java @@ -277,6 +277,7 @@ public void loadConfiguration() { disableMyceliumSpread = getBoolean("dynamics.disable-mycelium-spread", false); disableVineGrowth = getBoolean("dynamics.disable-vine-growth", false); disableRockGrowth = getBoolean("dynamics.disable-rock-growth", false); + disableSculkGrowth = getBoolean("dynamics.disable-sculk-growth", false); disableCropGrowth = getBoolean("dynamics.disable-crop-growth", false); disableSoilDehydration = getBoolean("dynamics.disable-soil-dehydration", false); disableCoralBlockFade = getBoolean("dynamics.disable-coral-block-fade", false); diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardBlockListener.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardBlockListener.java index 45b5a3f6..fbfb75e1 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardBlockListener.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/WorldGuardBlockListener.java @@ -601,6 +601,19 @@ public void onBlockSpread(BlockSpreadEvent event) { } } + if (Materials.isSculkGrowth(newType)) { + if (wcfg.disableSculkGrowth) { + event.setCancelled(true); + return; + } + + if (wcfg.useRegions && !StateFlag.test(WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery() + .queryState(BukkitAdapter.adapt(event.getBlock().getLocation()), (RegionAssociable) null, Flags.SCULK_GROWTH))) { + event.setCancelled(true); + return; + } + } + handleGrow(event, event.getBlock().getLocation(), newType); } diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java index 270a4b5a..f0aa1997 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java @@ -1615,4 +1615,8 @@ public static boolean isAmethystGrowth(Material mat) { || mat == Material.MEDIUM_AMETHYST_BUD || mat == Material.SMALL_AMETHYST_BUD; } + + public static boolean isSculkGrowth(Material mat) { + return mat == Material.SCULK || mat == Material.SCULK_VEIN; + } } diff --git a/worldguard-core/src/main/java/com/sk89q/worldguard/config/WorldConfiguration.java b/worldguard-core/src/main/java/com/sk89q/worldguard/config/WorldConfiguration.java index e3e0f125..33a92339 100644 --- a/worldguard-core/src/main/java/com/sk89q/worldguard/config/WorldConfiguration.java +++ b/worldguard-core/src/main/java/com/sk89q/worldguard/config/WorldConfiguration.java @@ -159,6 +159,7 @@ public abstract class WorldConfiguration { public boolean disableMyceliumSpread; public boolean disableVineGrowth; public boolean disableRockGrowth; + public boolean disableSculkGrowth; public boolean disableCropGrowth; public boolean disableEndermanGriefing; public boolean disableSnowmanTrails; diff --git a/worldguard-core/src/main/java/com/sk89q/worldguard/protection/flags/Flags.java b/worldguard-core/src/main/java/com/sk89q/worldguard/protection/flags/Flags.java index 218637b5..b8ccfb3f 100644 --- a/worldguard-core/src/main/java/com/sk89q/worldguard/protection/flags/Flags.java +++ b/worldguard-core/src/main/java/com/sk89q/worldguard/protection/flags/Flags.java @@ -121,6 +121,7 @@ public final class Flags { public static final StateFlag MYCELIUM_SPREAD = register(new StateFlag("mycelium-spread", true)); public static final StateFlag VINE_GROWTH = register(new StateFlag("vine-growth", true)); public static final StateFlag ROCK_GROWTH = register(new StateFlag("rock-growth", true)); + public static final StateFlag SCULK_GROWTH = register (new StateFlag("sculk-growth", true)); public static final StateFlag CROP_GROWTH = register(new StateFlag("crop-growth", true)); public static final StateFlag SOIL_DRY = register(new StateFlag("soil-dry", true)); public static final StateFlag CORAL_FADE = register(new StateFlag("coral-fade", true));