mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-08 11:59:43 +01:00
Added config option to disable explosion-caused damage to players.
This commit is contained in:
parent
424b580eb9
commit
4850bdefdf
@ -93,6 +93,7 @@ public class WorldConfiguration {
|
||||
public boolean teleportOnSuffocation;
|
||||
public boolean disableVoidDamage;
|
||||
public boolean teleportOnVoid;
|
||||
public boolean disableExplosionDamage;
|
||||
public boolean useRegions;
|
||||
public boolean highFreqFlags;
|
||||
public int regionWand = 287;
|
||||
@ -194,6 +195,7 @@ private void loadConfiguration() {
|
||||
teleportOnSuffocation = config.getBoolean("player-damage.teleport-on-suffocation", false);
|
||||
disableVoidDamage = config.getBoolean("player-damage.disable-void-damage", false);
|
||||
teleportOnVoid = config.getBoolean("player-damage.teleport-on-void-falling", false);
|
||||
disableExplosionDamage = config.getBoolean("player-damage.disable-explosion-damage", false);
|
||||
|
||||
signChestProtection = config.getBoolean("chest-protection.enable", false);
|
||||
|
||||
|
@ -128,6 +128,10 @@ public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (wcfg.disableExplosionDamage && event.getCause() == DamageCause.BLOCK_EXPLOSION) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,6 +155,11 @@ public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (wcfg.disableExplosionDamage && event.getCause() == DamageCause.ENTITY_EXPLOSION) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (attacker != null && attacker instanceof Player) {
|
||||
if (wcfg.useRegions) {
|
||||
Vector pt = toVector(defender.getLocation());
|
||||
|
@ -81,6 +81,7 @@ player-damage:
|
||||
teleport-on-suffocation: off
|
||||
disable-void-damage: off
|
||||
teleport-on-void-falling: off
|
||||
disable-explosion-damage: off
|
||||
|
||||
regions:
|
||||
enable: on
|
||||
|
Loading…
Reference in New Issue
Block a user