From 2b04da4b2519b844b77ef5d6b30fb916c7eb7bf0 Mon Sep 17 00:00:00 2001 From: ryanhamshire Date: Sat, 27 Jun 2015 09:34:34 -0700 Subject: [PATCH] Fixed invincible guard dogs. In PvP worlds, while in land claims, dogs could attack players but not be damaged in return. Now pet dogs are not protected in PvP-world land claims. Other types of pets are still protected as long as they're inside a land claim where the attacker doesn't have sufficient permission. --- .../GriefPrevention/EntityEventHandler.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/EntityEventHandler.java b/src/me/ryanhamshire/GriefPrevention/EntityEventHandler.java index 2f09ccf..b7c3e61 100644 --- a/src/me/ryanhamshire/GriefPrevention/EntityEventHandler.java +++ b/src/me/ryanhamshire/GriefPrevention/EntityEventHandler.java @@ -728,7 +728,7 @@ class EntityEventHandler implements Listener //otherwise disallow in non-pvp worlds if(!GriefPrevention.instance.config_pvp_enabledWorlds.contains(subEvent.getEntity().getLocation().getWorld())) { - OfflinePlayer owner = GriefPrevention.instance.getServer().getOfflinePlayer(ownerID); + OfflinePlayer owner = GriefPrevention.instance.getServer().getOfflinePlayer(ownerID); String ownerName = owner.getName(); if(ownerName == null) ownerName = "someone"; String message = GriefPrevention.instance.dataStore.getMessage(Messages.NoDamageClaimedEntity, ownerName); @@ -782,7 +782,7 @@ class EntityEventHandler implements Listener //all other cases else { - event.setCancelled(true); + event.setCancelled(true); if(damageSource != null && damageSource instanceof Projectile) { damageSource.remove(); @@ -790,9 +790,9 @@ class EntityEventHandler implements Listener } } - //otherwise the player damaging the entity must have permission - else - { + //otherwise the player damaging the entity must have permission, unless it's a dog in a pvp world + else if(!(GriefPrevention.instance.pvpRulesApply(event.getEntity().getWorld()) && event.getEntity().getType() == EntityType.WOLF)) + { String noContainersReason = claim.allowContainers(attacker); if(noContainersReason != null) {