Merge pull request #1989 from EngineHub/feature/copper-fade-flag

Add copper-fade flag to WorldGuard
This commit is contained in:
JOO200 2023-03-23 15:05:53 +01:00 committed by GitHub
commit 216f95f87c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 0 deletions

View File

@ -281,6 +281,7 @@ public class BukkitWorldConfiguration extends YamlWorldConfiguration {
disableCropGrowth = getBoolean("dynamics.disable-crop-growth", false);
disableSoilDehydration = getBoolean("dynamics.disable-soil-dehydration", false);
disableCoralBlockFade = getBoolean("dynamics.disable-coral-block-fade", false);
disableCopperBlockFade = getBoolean("dynamics.disable-copper-block-fade", false);
allowedSnowFallOver = new HashSet<>(convertLegacyBlocks(getStringList("dynamics.snow-fall-blocks", null)));
useRegions = getBoolean("regions.enable", true);

View File

@ -697,6 +697,16 @@ public class WorldGuardBlockListener extends AbstractListener {
event.setCancelled(true);
return;
}
} else if (Materials.isUnwaxedCopper(event.getBlock().getType())) {
if (wcfg.disableCopperBlockFade) {
event.setCancelled(true);
return;
}
if (wcfg.useRegions && !StateFlag.test(WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery()
.queryState(BukkitAdapter.adapt(event.getBlock().getLocation()), (RegionAssociable) null, Flags.COPPER_FADE))) {
event.setCancelled(true);
return;
}
}
}

View File

@ -165,6 +165,7 @@ public abstract class WorldConfiguration {
public boolean disableSnowmanTrails;
public boolean disableSoilDehydration;
public boolean disableCoralBlockFade;
public boolean disableCopperBlockFade;
public Set<String> allowedSnowFallOver;
public boolean regionInvinciblityRemovesMobs;
public boolean regionCancelEmptyChatEvents;

View File

@ -125,6 +125,7 @@ public final class Flags {
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));
public static final StateFlag COPPER_FADE = register(new StateFlag("copper-fade", true));
public static final StateFlag WATER_FLOW = register(new StateFlag("water-flow", true));
public static final StateFlag LAVA_FLOW = register(new StateFlag("lava-flow", true));