mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-28 05:25:20 +01:00
Split off ender dragon block damage from creeper block damage.
This commit is contained in:
parent
6e8a185b63
commit
35f268319e
@ -101,6 +101,7 @@ public class WorldConfiguration {
|
|||||||
public boolean blockTNTBlockDamage;
|
public boolean blockTNTBlockDamage;
|
||||||
public boolean blockCreeperExplosions;
|
public boolean blockCreeperExplosions;
|
||||||
public boolean blockCreeperBlockDamage;
|
public boolean blockCreeperBlockDamage;
|
||||||
|
public boolean blockEnderDragonBlockDamage;
|
||||||
public boolean blockFireballExplosions;
|
public boolean blockFireballExplosions;
|
||||||
public boolean blockFireballBlockDamage;
|
public boolean blockFireballBlockDamage;
|
||||||
// public int loginProtection;
|
// public int loginProtection;
|
||||||
@ -314,6 +315,7 @@ private void loadConfiguration() {
|
|||||||
|
|
||||||
blockCreeperExplosions = getBoolean("mobs.block-creeper-explosions", false);
|
blockCreeperExplosions = getBoolean("mobs.block-creeper-explosions", false);
|
||||||
blockCreeperBlockDamage = getBoolean("mobs.block-creeper-block-damage", false);
|
blockCreeperBlockDamage = getBoolean("mobs.block-creeper-block-damage", false);
|
||||||
|
blockEnderDragonBlockDamage = getBoolean("mobs.block-enderdragon-block-damage", false);
|
||||||
blockFireballExplosions = getBoolean("mobs.block-fireball-explosions", false);
|
blockFireballExplosions = getBoolean("mobs.block-fireball-explosions", false);
|
||||||
blockFireballBlockDamage = getBoolean("mobs.block-fireball-block-damage", false);
|
blockFireballBlockDamage = getBoolean("mobs.block-fireball-block-damage", false);
|
||||||
antiWolfDumbness = getBoolean("mobs.anti-wolf-dumbness", false);
|
antiWolfDumbness = getBoolean("mobs.anti-wolf-dumbness", false);
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
import org.bukkit.entity.Creature;
|
import org.bukkit.entity.Creature;
|
||||||
import org.bukkit.entity.CreatureType;
|
import org.bukkit.entity.CreatureType;
|
||||||
import org.bukkit.entity.Creeper;
|
import org.bukkit.entity.Creeper;
|
||||||
|
import org.bukkit.entity.EnderDragon;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Fireball;
|
import org.bukkit.entity.Fireball;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -543,7 +544,7 @@ public void onEntityExplode(EntityExplodeEvent event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ent instanceof LivingEntity) {
|
if (ent instanceof Creeper) {
|
||||||
if (wcfg.blockCreeperBlockDamage || wcfg.blockCreeperExplosions) {
|
if (wcfg.blockCreeperBlockDamage || wcfg.blockCreeperExplosions) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -561,6 +562,24 @@ public void onEntityExplode(EntityExplodeEvent event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (ent instanceof EnderDragon) {
|
||||||
|
if (wcfg.blockEnderDragonBlockDamage) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wcfg.useRegions) {
|
||||||
|
if (wcfg.useRegions) {
|
||||||
|
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
|
||||||
|
|
||||||
|
for (Block block : event.blockList()) {
|
||||||
|
if (!mgr.getApplicableRegions(toVector(block)).allows(DefaultFlag.ENDERDRAGON_BLOCK_DAMAGE)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (ent instanceof TNTPrimed) {
|
} else if (ent instanceof TNTPrimed) {
|
||||||
if (wcfg.blockTNTBlockDamage || wcfg.blockTNTExplosions) {
|
if (wcfg.blockTNTBlockDamage || wcfg.blockTNTExplosions) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -33,6 +33,7 @@ public final class DefaultFlag {
|
|||||||
public static final StateFlag MOB_DAMAGE = new StateFlag("mob-damage", 'm', true);
|
public static final StateFlag MOB_DAMAGE = new StateFlag("mob-damage", 'm', true);
|
||||||
public static final StateFlag MOB_SPAWNING = new StateFlag("mob-spawning", true);
|
public static final StateFlag MOB_SPAWNING = new StateFlag("mob-spawning", true);
|
||||||
public static final StateFlag CREEPER_EXPLOSION = new StateFlag("creeper-explosion", 'c', true);
|
public static final StateFlag CREEPER_EXPLOSION = new StateFlag("creeper-explosion", 'c', true);
|
||||||
|
public static final StateFlag ENDERDRAGON_BLOCK_DAMAGE = new StateFlag("enderdragon-block-damage", true);
|
||||||
public static final StateFlag GHAST_FIREBALL = new StateFlag("ghast-fireball", true);
|
public static final StateFlag GHAST_FIREBALL = new StateFlag("ghast-fireball", true);
|
||||||
public static final StateFlag SLEEP = new StateFlag("sleep", true);
|
public static final StateFlag SLEEP = new StateFlag("sleep", true);
|
||||||
public static final StateFlag TNT = new StateFlag("tnt", 't', true);
|
public static final StateFlag TNT = new StateFlag("tnt", 't', true);
|
||||||
@ -86,7 +87,7 @@ public final class DefaultFlag {
|
|||||||
PASSTHROUGH, BUILD, PVP, CHEST_ACCESS, PISTONS,
|
PASSTHROUGH, BUILD, PVP, CHEST_ACCESS, PISTONS,
|
||||||
TNT, LIGHTER, USE, PLACE_VEHICLE, DESTROY_VEHICLE, SLEEP,
|
TNT, LIGHTER, USE, PLACE_VEHICLE, DESTROY_VEHICLE, SLEEP,
|
||||||
MOB_DAMAGE, MOB_SPAWNING, DENY_SPAWN, INVINCIBILITY,
|
MOB_DAMAGE, MOB_SPAWNING, DENY_SPAWN, INVINCIBILITY,
|
||||||
CREEPER_EXPLOSION, GHAST_FIREBALL, ENDER_BUILD,
|
CREEPER_EXPLOSION, ENDERDRAGON_BLOCK_DAMAGE, GHAST_FIREBALL, ENDER_BUILD,
|
||||||
GREET_MESSAGE, FAREWELL_MESSAGE, NOTIFY_ENTER, NOTIFY_LEAVE,
|
GREET_MESSAGE, FAREWELL_MESSAGE, NOTIFY_ENTER, NOTIFY_LEAVE,
|
||||||
EXIT, EXIT_PERM, ENTRY, ENTRY_PERM,
|
EXIT, EXIT_PERM, ENTRY, ENTRY_PERM,
|
||||||
HEAL_AMOUNT, HEAL_DELAY, MIN_HEAL, MAX_HEAL,
|
HEAL_AMOUNT, HEAL_DELAY, MIN_HEAL, MAX_HEAL,
|
||||||
|
Loading…
Reference in New Issue
Block a user