More complete releasing of pets on claim delete.

Horses were keeping their owner info and inventories, even though they
were marked as "wild".  This somehow prevents them from being tamed by
another player, and also their inventories can't be accessed by anyone.
Will work on retroactively fixing the existing horses in this odd state
in another commit.
This commit is contained in:
ryanhamshire 2016-04-13 20:12:21 -07:00
parent 9c53b8e4b9
commit c92986bf5d

View File

@ -33,6 +33,7 @@ import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import com.google.common.io.Files;
@ -642,6 +643,12 @@ public abstract class DataStore
if(ownerID.equals(claim.ownerID))
{
pet.setTamed(false);
pet.setOwner(null);
if(pet instanceof InventoryHolder)
{
InventoryHolder holder = (InventoryHolder)pet;
holder.getInventory().clear();
}
}
}
}