PaperSpigot-Parent/CraftBukkit-Patches/0146-Stop-player-skull-s-name-being-incorrectly-set-to-th.patch

30 lines
1.2 KiB
Diff

From 3f29564abde66be189515e902fba65c95615cf91 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Thu, 17 Apr 2014 13:00:05 +0100
Subject: [PATCH] Stop player skull's name being incorrectly set to the
profiles's toString
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
index 41efa55..c484c57 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -32,7 +32,13 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
super(tag);
if (tag.hasKey(SKULL_OWNER.NBT)) {
- player = tag.getString(SKULL_OWNER.NBT);
+ if ( tag.hasKeyOfType( SKULL_OWNER.NBT, 10, true ) )
+ {
+ player = net.minecraft.server.GameProfileSerializer.a( tag.getCompound( SKULL_OWNER.NBT ) ).getName();
+ } else if ( tag.hasKeyOfType( SKULL_OWNER.NBT, 8 ) )
+ {
+ player = tag.getString( SKULL_OWNER.NBT );
+ }
}
}
--
1.8.5.2.msysgit.0