From c92986bf5d10f74faa945164dd8d8bed11e21ae6 Mon Sep 17 00:00:00 2001 From: ryanhamshire Date: Wed, 13 Apr 2016 20:12:21 -0700 Subject: [PATCH] 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. --- src/me/ryanhamshire/GriefPrevention/DataStore.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/me/ryanhamshire/GriefPrevention/DataStore.java b/src/me/ryanhamshire/GriefPrevention/DataStore.java index 4e89314..b91412e 100644 --- a/src/me/ryanhamshire/GriefPrevention/DataStore.java +++ b/src/me/ryanhamshire/GriefPrevention/DataStore.java @@ -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(); + } } } }