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.
This commit is contained in:
ryanhamshire 2015-06-27 09:34:34 -07:00
parent 8bd39580f6
commit 2b04da4b25

View File

@ -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)
{