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:
parent
8bd39580f6
commit
2b04da4b25
|
|
@ -728,7 +728,7 @@ class EntityEventHandler implements Listener
|
||||||
//otherwise disallow in non-pvp worlds
|
//otherwise disallow in non-pvp worlds
|
||||||
if(!GriefPrevention.instance.config_pvp_enabledWorlds.contains(subEvent.getEntity().getLocation().getWorld()))
|
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();
|
String ownerName = owner.getName();
|
||||||
if(ownerName == null) ownerName = "someone";
|
if(ownerName == null) ownerName = "someone";
|
||||||
String message = GriefPrevention.instance.dataStore.getMessage(Messages.NoDamageClaimedEntity, ownerName);
|
String message = GriefPrevention.instance.dataStore.getMessage(Messages.NoDamageClaimedEntity, ownerName);
|
||||||
|
|
@ -782,7 +782,7 @@ class EntityEventHandler implements Listener
|
||||||
//all other cases
|
//all other cases
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if(damageSource != null && damageSource instanceof Projectile)
|
if(damageSource != null && damageSource instanceof Projectile)
|
||||||
{
|
{
|
||||||
damageSource.remove();
|
damageSource.remove();
|
||||||
|
|
@ -790,8 +790,8 @@ class EntityEventHandler implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//otherwise the player damaging the entity must have permission
|
//otherwise the player damaging the entity must have permission, unless it's a dog in a pvp world
|
||||||
else
|
else if(!(GriefPrevention.instance.pvpRulesApply(event.getEntity().getWorld()) && event.getEntity().getType() == EntityType.WOLF))
|
||||||
{
|
{
|
||||||
String noContainersReason = claim.allowContainers(attacker);
|
String noContainersReason = claim.allowContainers(attacker);
|
||||||
if(noContainersReason != null)
|
if(noContainersReason != null)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user