From 1a9f3189593429c11ad4b06ff6fe590e807362c6 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 3 May 2014 17:42:19 -0500 Subject: [PATCH] Avoid using the user cache in skull meta. To handle changes in 1.7.9 we changed skull meta to use GameProfile instances instead of strings of player names. This reflects what vanilla is actually storing for skulls now. As skulls still require a name our API was not changed and we instead look up the rest of the profile information from the name. The way this was implemented made it so that deserializing a skull or setting its name potentially involved a network request. As skull meta itself does not actually require a complete profile we now simply create one that only contains a name and leave populating it to the server when it is actually needed. By: Travis Watkins --- .../bukkit/craftbukkit/inventory/CraftMetaSkull.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java index 15e114dfe7..2fe10005ff 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java @@ -36,7 +36,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { if (tag.hasKeyOfType(SKULL_OWNER.NBT, 10)) { profile = GameProfileSerializer.a(tag.getCompound(SKULL_OWNER.NBT)); } else if (tag.hasKeyOfType(SKULL_OWNER.NBT, 8)) { - profile = MinecraftServer.getServer().getUserCache().a(tag.getString(SKULL_OWNER.NBT)); + profile = new GameProfile(null, tag.getString(SKULL_OWNER.NBT)); } } @@ -93,12 +93,12 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { return false; } - GameProfile profile = MinecraftServer.getServer().getUserCache().a(name); - if (profile == null) { - return false; + if (name == null) { + profile = null; + } else { + profile = new GameProfile(null, name); } - this.profile = profile; return true; }