Fix-up for "broken" abandoned pets.

This commit is contained in:
ryanhamshire 2016-04-15 21:08:36 -07:00
parent 9285e475a7
commit faee4efbef

View File

@ -1210,7 +1210,9 @@ class PlayerEventHandler implements Listener
if(entity instanceof Tameable) if(entity instanceof Tameable)
{ {
Tameable tameable = (Tameable)entity; Tameable tameable = (Tameable)entity;
if(tameable.isTamed() && tameable.getOwner() != null) if(tameable.isTamed())
{
if(tameable.getOwner() != null)
{ {
UUID ownerID = tameable.getOwner().getUniqueId(); UUID ownerID = tameable.getOwner().getUniqueId();
@ -1243,6 +1245,17 @@ class PlayerEventHandler implements Listener
} }
} }
} }
else //world repair code for a now-fixed GP bug
{
//ensure this entity can be tamed by players
tameable.setOwner(null);
if(tameable instanceof InventoryHolder)
{
InventoryHolder holder = (InventoryHolder)tameable;
holder.getInventory().clear();
}
}
}
//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)