mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-02-26 09:11:31 +01:00
Added regions.invincibility-removes-mobs so you can turn on invincibility without creating the possibility about farming.
This commit is contained in:
parent
671b4fe2db
commit
cfffba25cf
@ -143,6 +143,7 @@ public class WorldConfiguration {
|
||||
public boolean disableSnowFormation;
|
||||
public boolean disableIceFormation;
|
||||
public boolean disableLeafDecay;
|
||||
public boolean regionInvinciblityRemovesMobs;
|
||||
|
||||
/* Configuration data end */
|
||||
|
||||
@ -318,6 +319,7 @@ private void loadConfiguration() {
|
||||
disableLeafDecay = getBoolean("dynamics.disable-leaf-decay", false);
|
||||
|
||||
useRegions = getBoolean("regions.enable", true);
|
||||
regionInvinciblityRemovesMobs = getBoolean("regions.invincibility-removes-mobs", false);
|
||||
highFreqFlags = getBoolean("regions.high-frequency-flags", false);
|
||||
regionWand = getInt("regions.wand", 287);
|
||||
maxClaimVolume = getInt("regions.max-claim-volume", 30000);
|
||||
|
@ -210,8 +210,18 @@ private void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
WorldConfiguration wcfg = cfg.get(player.getWorld());
|
||||
|
||||
if (cfg.hasGodMode(player)
|
||||
|| (wcfg.useRegions && RegionQueryUtil.isInvincible(plugin, player))) {
|
||||
if (cfg.hasGodMode(player)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (wcfg.useRegions && RegionQueryUtil.isInvincible(plugin, player)) {
|
||||
if (wcfg.regionInvinciblityRemovesMobs
|
||||
&& attacker instanceof LivingEntity && !(attacker instanceof Player)
|
||||
&& !(attacker instanceof Tameable && ((Tameable) attacker).isTamed())) {
|
||||
attacker.remove();
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user