Added config to disable damage from falling into the void.

This commit is contained in:
Wizjany 2011-04-03 05:48:32 -04:00
parent 21a04cc8c8
commit 3cb9b90ef0
3 changed files with 36 additions and 18 deletions

View File

@ -67,6 +67,8 @@ player-damage:
disable-suffocation-damage: off
disable-contact-damage: off
teleport-on-suffocation: off
disable-void-damage: off
teleport-on-void-falling: off
regions:
enable: on

View File

@ -86,6 +86,8 @@ public class WorldConfiguration {
public boolean disableDrowningDamage;
public boolean disableSuffocationDamage;
public boolean teleportOnSuffocation;
public boolean disableVoidDamage;
public boolean teleportOnVoid;
public boolean useRegions;
public boolean highFreqFlags;
public int regionWand = 287;
@ -169,6 +171,9 @@ private void loadConfiguration() {
disableSuffocationDamage = config.getBoolean("player-damage.disable-suffocation-damage", false);
disableContactDamage = config.getBoolean("player-damage.disable-contact-damage", false);
teleportOnSuffocation = config.getBoolean("player-damage.teleport-on-suffocation", false);
disableVoidDamage = config.getBoolean("player-damage.disable-void-damage", false);
//this is pretty useless since presumably there won't be much above them if they fall into a big hole
teleportOnVoid = config.getBoolean("player-damage.teleport-on-void-falling", false);
useRegions = config.getBoolean("regions.enable", true);
highFreqFlags = config.getBoolean("regions.high-frequency-flags", false);

View File

@ -93,6 +93,17 @@ public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
return;
}
if (wcfg.teleportOnVoid && type == DamageCause.VOID) {
findFreePosition(player);
event.setCancelled(true);
return;
}
if (wcfg.disableVoidDamage && type == DamageCause.VOID) {
event.setCancelled(true);
return;
}
}
}