AnimalTamer already has a getName() method.

This commit is contained in:
GJ 2013-03-03 15:22:40 -05:00
parent 7c28be5e62
commit 1fc3c8fab2
2 changed files with 1 additions and 20 deletions

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.skills.taming; package com.gmail.nossr50.skills.taming;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -71,24 +70,6 @@ public class Taming {
wolf.playEffect(EntityEffect.WOLF_HEARTS); wolf.playEffect(EntityEffect.WOLF_HEARTS);
} }
/**
* Get the name of a tameable animal's owner.
*
* @return the name of the animal's owner
*/
protected static String getOwnerName(Tameable beast) {
AnimalTamer tamer = beast.getOwner();
if (tamer instanceof Player) {
return ((Player) tamer).getName();
}
else if (tamer instanceof OfflinePlayer) {
return ((OfflinePlayer) tamer).getName();
}
return "Unknown Master";
}
protected static String getCallOfTheWildFailureMessage(EntityType type) { protected static String getCallOfTheWildFailureMessage(EntityType type) {
switch (type) { switch (type) {
case OCELOT: case OCELOT:

View File

@ -133,7 +133,7 @@ public class TamingManager extends SkillManager {
String message = LocaleLoader.getString("Combat.BeastLore") + " "; String message = LocaleLoader.getString("Combat.BeastLore") + " ";
if (beast.isTamed()) { if (beast.isTamed()) {
message = message.concat(LocaleLoader.getString("Combat.BeastLoreOwner", Taming.getOwnerName(beast)) + " "); message = message.concat(LocaleLoader.getString("Combat.BeastLoreOwner", beast.getOwner().getName()) + " ");
} }
message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", target.getHealth(), target.getMaxHealth())); message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", target.getHealth(), target.getMaxHealth()));