Fixed /givepet not working in PvP worlds.

This commit is contained in:
ryanhamshire 2015-02-03 18:48:01 -08:00
parent db10863616
commit 31aa352648

View File

@ -921,7 +921,7 @@ class PlayerEventHandler implements Listener
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId()); PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
//if entity is tameable and has an owner, apply special rules //if entity is tameable and has an owner, apply special rules
if(entity instanceof Tameable && !GriefPrevention.instance.config_pvp_enabledWorlds.contains(entity.getLocation().getWorld())) if(entity instanceof Tameable)
{ {
Tameable tameable = (Tameable)entity; Tameable tameable = (Tameable)entity;
if(tameable.isTamed() && tameable.getOwner() != null) if(tameable.isTamed() && tameable.getOwner() != null)
@ -943,6 +943,8 @@ class PlayerEventHandler implements Listener
return; return;
} }
if(!GriefPrevention.instance.config_pvp_enabledWorlds.contains(entity.getLocation().getWorld()))
{
//otherwise disallow //otherwise disallow
OfflinePlayer owner = GriefPrevention.instance.getServer().getOfflinePlayer(ownerID); OfflinePlayer owner = GriefPrevention.instance.getServer().getOfflinePlayer(ownerID);
String ownerName = owner.getName(); String ownerName = owner.getName();
@ -955,6 +957,7 @@ class PlayerEventHandler implements Listener
return; return;
} }
} }
}
//don't allow interaction with item frames or armor stands in claimed areas without build permission //don't allow interaction with item frames or armor stands in claimed areas without build permission
if(entity.getType() == EntityType.ARMOR_STAND || entity instanceof Hanging) if(entity.getType() == EntityType.ARMOR_STAND || entity instanceof Hanging)