Updated for 1.5 and added existing lightning protection.

This commit is contained in:
Wizjany 2011-04-24 15:53:32 -04:00
parent 1cedf0e9a0
commit 925fa2ee1b
6 changed files with 43 additions and 3 deletions

View File

@ -15,7 +15,6 @@
<include name="WorldEdit.jar" /> <include name="WorldEdit.jar" />
<include name="iConomy.jar" /> <include name="iConomy.jar" />
<include name="prtree.jar" /> <include name="prtree.jar" />
<include name="snakeyaml.jar" />
</fileset> </fileset>
<target name="init"> <target name="init">

View File

@ -47,6 +47,16 @@ fire:
disable-lava-fire-spread: on disable-lava-fire-spread: on
lava-spread-blocks: [] lava-spread-blocks: []
weather:
disable-weather: off
disable-thunderstorm: off
disable-pig-zombification: off
disable-powered-creepers: off
disable-lightning-strike-fire: off
prevent-lightning-strike-blocks: []
always-raining: off
always-thundering: off
mobs: mobs:
block-creeper-explosions: off block-creeper-explosions: off
block-creeper-block-damage: off block-creeper-block-damage: off
@ -64,6 +74,7 @@ player-damage:
disable-fall-damage: off disable-fall-damage: off
disable-lava-damage: off disable-lava-damage: off
disable-fire-damage: off disable-fire-damage: off
disable-lightning-damage: off
disable-drowning-damage: off disable-drowning-damage: off
disable-suffocation-damage: off disable-suffocation-damage: off
disable-contact-damage: off disable-contact-damage: off

View File

@ -86,6 +86,7 @@ public class WorldConfiguration {
public boolean disableFallDamage; public boolean disableFallDamage;
public boolean disableLavaDamage; public boolean disableLavaDamage;
public boolean disableFireDamage; public boolean disableFireDamage;
public boolean disableLightningDamage;
public boolean disableDrowningDamage; public boolean disableDrowningDamage;
public boolean disableSuffocationDamage; public boolean disableSuffocationDamage;
public boolean teleportOnSuffocation; public boolean teleportOnSuffocation;
@ -106,6 +107,14 @@ public class WorldConfiguration {
public boolean removeInfiniteStacks; public boolean removeInfiniteStacks;
public boolean disableCreatureCropTrampling; public boolean disableCreatureCropTrampling;
public boolean disablePlayerCropTrampling; public boolean disablePlayerCropTrampling;
public boolean preventLightningFire;
public Set<Integer> disallowedLightningBlocks;
public boolean disableThunder;
public boolean disableWeather;
public boolean alwaysRaining;
public boolean alwaysThundering;
public boolean disablePigZap;
public boolean disableCreeperPower;
/* Configuration data end */ /* Configuration data end */
@ -175,6 +184,7 @@ private void loadConfiguration() {
disableFallDamage = config.getBoolean("player-damage.disable-fall-damage", false); disableFallDamage = config.getBoolean("player-damage.disable-fall-damage", false);
disableLavaDamage = config.getBoolean("player-damage.disable-lava-damage", false); disableLavaDamage = config.getBoolean("player-damage.disable-lava-damage", false);
disableFireDamage = config.getBoolean("player-damage.disable-fire-damage", false); disableFireDamage = config.getBoolean("player-damage.disable-fire-damage", false);
disableLightningDamage = config.getBoolean("player-damage.disable-lightning-damage", false);
disableDrowningDamage = config.getBoolean("player-damage.disable-drowning-damage", false); disableDrowningDamage = config.getBoolean("player-damage.disable-drowning-damage", false);
disableSuffocationDamage = config.getBoolean("player-damage.disable-suffocation-damage", false); disableSuffocationDamage = config.getBoolean("player-damage.disable-suffocation-damage", false);
disableContactDamage = config.getBoolean("player-damage.disable-contact-damage", false); disableContactDamage = config.getBoolean("player-damage.disable-contact-damage", false);
@ -187,6 +197,15 @@ private void loadConfiguration() {
disableCreatureCropTrampling = config.getBoolean("crops.disable-creature-trampling", false); disableCreatureCropTrampling = config.getBoolean("crops.disable-creature-trampling", false);
disablePlayerCropTrampling = config.getBoolean("crops.disable-player-trampling", false); disablePlayerCropTrampling = config.getBoolean("crops.disable-player-trampling", false);
disallowedLightningBlocks = new HashSet<Integer>(config.getIntList("weather.prevent-lightning-strike-blocks", null));
preventLightningFire = config.getBoolean("weather.disable-lightning-strike-fire", false);
disableThunder = config.getBoolean("weather.disable-thunderstorm", false);
disableWeather = config.getBoolean("weather.disable-weather", false);
disablePigZap = config.getBoolean("weather.disable-pig-zombification", false);
disableCreeperPower = config.getBoolean("weather.disable-powered-creepers", false);
alwaysRaining = config.getBoolean("weather.always-raining", false);
alwaysThundering = config.getBoolean("weather.always-thundering", false);
useRegions = config.getBoolean("regions.enable", true); useRegions = config.getBoolean("regions.enable", true);
highFreqFlags = config.getBoolean("regions.high-frequency-flags", false); highFreqFlags = config.getBoolean("regions.high-frequency-flags", false);
regionWand = config.getInt("regions.wand", 287); regionWand = config.getInt("regions.wand", 287);

View File

@ -253,6 +253,11 @@ public void onBlockIgnite(BlockIgniteEvent event) {
boolean isFireSpread = cause == IgniteCause.SPREAD; boolean isFireSpread = cause == IgniteCause.SPREAD;
if (wcfg.preventLightningFire && cause == IgniteCause.LIGHTNING) {
event.setCancelled(true);
return;
}
if (wcfg.preventLavaFire && cause == IgniteCause.LAVA) { if (wcfg.preventLavaFire && cause == IgniteCause.LAVA) {
event.setCancelled(true); event.setCancelled(true);
return; return;

View File

@ -143,6 +143,11 @@ public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
return; return;
} }
if (wcfg.disableLightningDamage && event.getCause() == DamageCause.LIGHTNING) {
event.setCancelled(true);
return;
}
if (attacker != null && attacker instanceof Player) { if (attacker != null && attacker instanceof Player) {
if (wcfg.useRegions) { if (wcfg.useRegions) {
Vector pt = toVector(defender.getLocation()); Vector pt = toVector(defender.getLocation());

View File

@ -278,7 +278,8 @@ public void handleBlockRightClick(PlayerInteractEvent event) {
} }
} }
if (type == Material.RAILS && item.getType() == Material.MINECART) { if ((type == Material.RAILS || type == Material.POWERED_RAIL || type == Material.DETECTOR_RAIL)
&& item.getType() == Material.MINECART) {
if (!plugin.getGlobalRegionManager().hasBypass(player, world) if (!plugin.getGlobalRegionManager().hasBypass(player, world)
&& !set.canBuild(localPlayer) && !set.canBuild(localPlayer)
&& !set.allows(DefaultFlag.PLACE_VEHICLE)) { && !set.allows(DefaultFlag.PLACE_VEHICLE)) {