Skip a null tamed owner name when restoring an entity (#1012)

A tamed animal whose owner has no known name is stored with a null owner, and restoring it throws a NullPointerException at the owner step, which drops the rest of the restore. A null owner name is now skipped like an empty one.
This commit is contained in:
Sage Kummer authored and GitHub committed 2026-09-25 15:10:27 -06:00
1 parent 72d5655ee9
commit 335fec2036
1 file changed
+2 -1
@@ -195,7 +195,8 @@ public class EntityUtil {
}
else if (count == 1) {
String set = (String) value;
if (set.length() > 0) {
// An owner whose name the server never learned was stored as null
if (set != null && set.length() > 0) {
Player owner = Bukkit.getServer().getPlayer(set);
if (owner == null) {
OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(set);