Fix an possible NPE

Former-commit-id: f8dc6d89ab76d236b6127a7645a9b5eeaca87a2c [formerly e9872021fca2ba30007b79d1efdf836d293a8220]
Former-commit-id: dbb0768e731783d06f5ffa0f7317ae8e8d51ebd2
This commit is contained in:
Ghost_chu committed 2019-06-09 19:41:44 +08:00
1 parent 91007c775d
commit 79bc69be81
1 file changed
+7 -2
@@ -852,8 +852,13 @@ public class MsgUtil {
if (livingEntity instanceof Tameable) {
Tameable tamedEntity = (Tameable) livingEntity;
AnimalTamer tamer = tamedEntity.getOwner();
Util.sendMessageToOps(ChatColor.RED + "Exploiter: " + "LivingEntity=" + livingEntity.getType()
.name() + "; Tamer=" + Bukkit.getOfflinePlayer(tamer.getUniqueId()));
if (tamer != null) {
Util.sendMessageToOps(ChatColor.RED + "Exploiter: " + "LivingEntity=" + livingEntity.getType()
.name() + "; Tamer=" + Bukkit.getOfflinePlayer(tamer.getUniqueId()));
} else {
Util.sendMessageToOps(ChatColor.RED + "Exploiter: " + "LivingEntity=" + livingEntity.getType()
.name());
}
}
Util.sendMessageToOps(ChatColor.RED + "Exploiter: " + "LivingEntity=" + livingEntity.getType().name());
}