diff options
author | Wesley Wolfe <weswolf@aol.com> | 2012-05-24 23:02:02 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2012-05-24 23:02:02 -0500 |
commit | 5d3c8bfaa4d3483bef297241de284ff4916fd79d (patch) | |
tree | c15e4c85e83cc1a433dcabcc0fe564306f52bfb3 /src | |
parent | c43012ef1caed94c27038652b3a11f6b9bcce6fd (diff) | |
download | craftbukkit-5d3c8bfaa4d3483bef297241de284ff4916fd79d.tar craftbukkit-5d3c8bfaa4d3483bef297241de284ff4916fd79d.tar.gz craftbukkit-5d3c8bfaa4d3483bef297241de284ff4916fd79d.tar.lz craftbukkit-5d3c8bfaa4d3483bef297241de284ff4916fd79d.tar.xz craftbukkit-5d3c8bfaa4d3483bef297241de284ff4916fd79d.zip |
Removed AnimalTamer cache, fixes BUKKIT-1628
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java index 5226c392..04520be3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java @@ -4,12 +4,9 @@ import net.minecraft.server.EntityTameableAnimal; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.Creature; -import org.bukkit.entity.Player; import org.bukkit.entity.Tameable; public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creature { - private AnimalTamer owner; - public CraftTameableAnimal(CraftServer server, EntityTameableAnimal entity) { super(server, entity); } @@ -20,12 +17,11 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat } public AnimalTamer getOwner() { - if (owner == null && !("").equals(getOwnerName())) { - owner = getServer().getPlayer(getOwnerName()); + if (("").equals(getOwnerName())) return null; - if (owner == null) { - owner = getServer().getOfflinePlayer(getOwnerName()); - } + AnimalTamer owner = getServer().getPlayerExact(getOwnerName()); + if (owner == null) { + owner = getServer().getOfflinePlayer(getOwnerName()); } return owner; @@ -40,17 +36,10 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat } public void setOwner(AnimalTamer tamer) { - owner = tamer; - - if (owner != null) { + if (tamer != null) { setTamed(true); getHandle().setPathEntity(null); - - if (owner instanceof Player) { - setOwnerName(((Player) owner).getName()); - } else { - setOwnerName(""); - } + setOwnerName(tamer.getName()); } else { setTamed(false); setOwnerName(""); @@ -58,7 +47,7 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat } public void setOwnerName(String ownerName) { - getHandle().setOwnerName(ownerName); + getHandle().setOwnerName(ownerName == null ? "" : ownerName); } public void setTamed(boolean tame) { |