BeastLore can now display Offline Owner names

This commit is contained in:
TfT_02 2013-01-30 18:35:46 +01:00
parent 1c0cafc6c8
commit 5e6b1fe362
2 changed files with 8 additions and 2 deletions

View File

@ -53,6 +53,8 @@ Version 1.4.00-dev
! Changed McMMOChatEvent to contain the plugin that the event originated from. ! Changed McMMOChatEvent to contain the plugin that the event originated from.
! Changed Excavation to have individual XP values for each block type, rather than a base XP value. ! Changed Excavation to have individual XP values for each block type, rather than a base XP value.
! Changed the way party teleportation works. When using /ptp, the target player needs to confirm the teleport before it takes place. (Configurable) ! Changed the way party teleportation works. When using /ptp, the target player needs to confirm the teleport before it takes place. (Configurable)
! Changed BeastLore: Now also displays offline player names
- Removed Party "master/apprentice" system. Replaced with the new party XP share feature.
Version 1.3.14 Version 1.3.14
+ Added new Hylian Luck skill to Herbalism. + Added new Hylian Luck skill to Herbalism.

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.skills.taming; package com.gmail.nossr50.skills.taming;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -36,7 +37,7 @@ public class BeastLoreEventHandler {
* Get the name of a tameable animal's owner. * Get the name of a tameable animal's owner.
* *
* @param beast The animal whose owner's name to get * @param beast The animal whose owner's name to get
* @return the name of the animal's owner, or "Offline Master" if the owner is offline * @return the name of the animal's owner
*/ */
private String getOwnerName() { private String getOwnerName() {
AnimalTamer tamer = beast.getOwner(); AnimalTamer tamer = beast.getOwner();
@ -44,7 +45,10 @@ public class BeastLoreEventHandler {
if (tamer instanceof Player) { if (tamer instanceof Player) {
return ((Player) tamer).getName(); return ((Player) tamer).getName();
} }
else if (tamer instanceof OfflinePlayer) {
return ((OfflinePlayer)tamer).getName();
}
return "Offline Master"; return "Unknown Master";
} }
} }