diff options
author | Mike Primm <mike@primmhome.com> | 2011-04-08 09:33:03 -0500 |
---|---|---|
committer | Andrew Ardill <andrew.ardill@gmail.com> | 2011-05-02 23:55:46 +1000 |
commit | 02d7f32e8f55ab30fd0a48d00e70e1f57f6f0290 (patch) | |
tree | db23ea4cca70965a811d0472a06564d34417a84c /src/main | |
parent | cd3c8fcfc8ce59d600c88505101a9d2ad2c79039 (diff) | |
download | craftbukkit-02d7f32e8f55ab30fd0a48d00e70e1f57f6f0290.tar craftbukkit-02d7f32e8f55ab30fd0a48d00e70e1f57f6f0290.tar.gz craftbukkit-02d7f32e8f55ab30fd0a48d00e70e1f57f6f0290.tar.lz craftbukkit-02d7f32e8f55ab30fd0a48d00e70e1f57f6f0290.tar.xz craftbukkit-02d7f32e8f55ab30fd0a48d00e70e1f57f6f0290.zip |
Fix isSitting()/setSitting(), add isTame()/setTame()/getOwner()/setOwner() methods
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java index 9a6a8a88..7bcb75be 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java @@ -4,6 +4,7 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.EntityWolf; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Wolf; +import net.minecraft.server.PathEntity; public class CraftWolf extends CraftAnimals implements Wolf { public CraftWolf(CraftServer server, EntityWolf wolf) { @@ -26,6 +27,32 @@ public class CraftWolf extends CraftAnimals implements Wolf { getHandle().setSitting(sitting); } + public boolean isTame() { + return getHandle().m_(); + } + + public void setTame(boolean tame) { + getHandle().d(tame); + } + + public String getOwner() { + return getHandle().x(); + } + + public void setOwner(String player) { + EntityWolf e = getHandle(); + + if ((player != null) && (player.length() > 0)) { + e.d(true); /* Make him tame */ + e.a((PathEntity)null); /* Clear path */ + e.a(player); /* Set owner */ + } + else { + e.d(false); /* Make him not tame */ + e.a(""); /* Clear owner */ + } + } + @Override public EntityWolf getHandle() { return (EntityWolf) entity; @@ -33,6 +60,6 @@ public class CraftWolf extends CraftAnimals implements Wolf { @Override public String toString() { - return "CraftWolf[anger=" + isAngry() + ",owner=" + getTarget() + "]"; + return "CraftWolf[anger=" + isAngry() + ",owner=" + getOwner() + ",tame=" + isTame() + ",sitting=" + isSitting() + "]"; } } |