Added snow-fall-blocks option to config to restrict snow fall to certain blocks

This commit is contained in:
wizjany 2013-08-12 18:09:45 -04:00
parent ac525958c5
commit 0a54779fc4
2 changed files with 10 additions and 0 deletions

View File

@ -163,6 +163,7 @@ public class WorldConfiguration {
public boolean disableEndermanGriefing;
public boolean disableSnowmanTrails;
public boolean disableSoilDehydration;
public Set<Integer> allowedSnowFallOver;
public boolean regionInvinciblityRemovesMobs;
public boolean disableDeathMessages;
public boolean disableObsidianGenerators;
@ -403,6 +404,7 @@ private void loadConfiguration() {
disableMyceliumSpread = getBoolean("dynamics.disable-mycelium-spread", false);
disableVineGrowth = getBoolean("dynamics.disable-vine-growth", false);
disableSoilDehydration = getBoolean("dynamics.disable-soil-dehydration", false);
allowedSnowFallOver = new HashSet<Integer>(getIntList("dynamics.snow-fall-blocks", null));
useRegions = getBoolean("regions.enable", true);
regionInvinciblityRemovesMobs = getBoolean("regions.invincibility-removes-mobs", false);

View File

@ -702,6 +702,14 @@ public void onBlockForm(BlockFormEvent event) {
event.setCancelled(true);
return;
}
if (wcfg.allowedSnowFallOver.size() > 0) {
int targetId = event.getBlock().getRelative(0, -1, 0).getTypeId();
if (!wcfg.allowedSnowFallOver.contains(targetId)) {
event.setCancelled(true);
return;
}
}
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(
DefaultFlag.SNOW_FALL, event.getBlock().getLocation())) {
event.setCancelled(true);