Add Sculk Growth Flag and options to disable sculk growths

This commit is contained in:
JOO200 2022-06-11 16:47:44 +02:00 committed by wizjany
parent f8e8d0f01e
commit 857f7468d8
5 changed files with 20 additions and 0 deletions

View File

@ -277,6 +277,7 @@ public class BukkitWorldConfiguration extends YamlWorldConfiguration {
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);

View File

@ -601,6 +601,19 @@ public class WorldGuardBlockListener extends AbstractListener {
}
}
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);
}

View File

@ -1615,4 +1615,8 @@ public final class Materials {
|| mat == Material.MEDIUM_AMETHYST_BUD
|| mat == Material.SMALL_AMETHYST_BUD;
}
public static boolean isSculkGrowth(Material mat) {
return mat == Material.SCULK || mat == Material.SCULK_VEIN;
}
}

View File

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

View File

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