Просмотр исходного кода

BeastLore can now display Offline Owner names

TfT_02 12 лет назад
Родитель
Сommit
5e6b1fe362

+ 2 - 0
Changelog.txt

@@ -53,6 +53,8 @@ Version 1.4.00-dev
  ! 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 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
  + Added new Hylian Luck skill to Herbalism.

+ 6 - 2
src/main/java/com/gmail/nossr50/skills/taming/BeastLoreEventHandler.java

@@ -1,5 +1,6 @@
 package com.gmail.nossr50.skills.taming;
 
+import org.bukkit.OfflinePlayer;
 import org.bukkit.entity.AnimalTamer;
 import org.bukkit.entity.LivingEntity;
 import org.bukkit.entity.Player;
@@ -36,7 +37,7 @@ public class BeastLoreEventHandler {
      * Get the name of a tameable animal's owner.
      *
      * @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() {
         AnimalTamer tamer = beast.getOwner();
@@ -44,7 +45,10 @@ public class BeastLoreEventHandler {
         if (tamer instanceof Player) {
             return ((Player) tamer).getName();
         }
+        else if (tamer instanceof OfflinePlayer) {
+            return ((OfflinePlayer)tamer).getName();
+        }
 
-        return "Offline Master";
+        return "Unknown Master";
     }
 }