Added config option and flag to prevent spread of grass.

This commit is contained in:
Wizjany 2011-09-24 22:51:36 -04:00
parent 9343c300cd
commit c028331ef9
3 changed files with 17 additions and 1 deletions

View File

@ -148,6 +148,7 @@ public class WorldConfiguration {
public boolean disableSnowFormation;
public boolean disableIceFormation;
public boolean disableLeafDecay;
public boolean disableGrassGrowth;
public boolean disableEndermanGriefing;
public boolean regionInvinciblityRemovesMobs;
public boolean disableDeathMessages;
@ -330,6 +331,7 @@ private void loadConfiguration() {
disableSnowFormation = getBoolean("dynamics.disable-snow-formation", false);
disableIceFormation = getBoolean("dynamics.disable-ice-formation", false);
disableLeafDecay = getBoolean("dynamics.disable-leaf-decay", false);
disableGrassGrowth = getBoolean("dynamics.disable-grass-growth", false);
useRegions = getBoolean("regions.enable", true);
regionInvinciblityRemovesMobs = getBoolean("regions.invincibility-removes-mobs", false);

View File

@ -760,6 +760,18 @@ public void onBlockSpread(BlockSpreadEvent event) {
return;
}
}
if (fromType == Material.GRASS) {
if (wcfg.disableGrassGrowth) {
event.setCancelled(true);
return;
}
if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows(
DefaultFlag.GRASS_SPREAD, event.getBlock().getLocation())) {
event.setCancelled(true);
return;
}
}
}
/**

View File

@ -52,6 +52,7 @@ public final class DefaultFlag {
public static final StateFlag ICE_MELT = new StateFlag("ice-melt", true);
public static final StateFlag MUSHROOMS = new StateFlag("mushroom-growth", true);
public static final StateFlag LEAF_DECAY = new StateFlag("leaf-decay", true);
public static final StateFlag GRASS_SPREAD = new StateFlag("grass-growth", true);
public static final StateFlag ENDER_BUILD = new StateFlag("enderman-grief", true);
public static final StateFlag INVINCIBILITY = new StateFlag("invincible", false);
public static final StateFlag ENTRY = new StateFlag("entry", true);
@ -88,7 +89,8 @@ public final class DefaultFlag {
GREET_MESSAGE, FAREWELL_MESSAGE, NOTIFY_ENTER, NOTIFY_LEAVE,
EXIT, EXIT_PERM, ENTRY, ENTRY_PERM,
HEAL_AMOUNT, HEAL_DELAY, MIN_HEAL, MAX_HEAL, INVINCIBILITY,
SNOW_FALL, SNOW_MELT, ICE_FORM, ICE_MELT, MUSHROOMS, LEAF_DECAY,
SNOW_FALL, SNOW_MELT, ICE_FORM, ICE_MELT,
MUSHROOMS, LEAF_DECAY, GRASS_SPREAD,
FIRE_SPREAD, LAVA_FIRE, LAVA_FLOW, WATER_FLOW,
TELE_LOC, TELE_PERM, SPAWN_LOC, SPAWN_PERM,
BLOCKED_CMDS, ALLOWED_CMDS, PRICE, BUYABLE,