From 690a908b971e327c5f77ed73d8d52a7556570afd Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Sat, 3 May 2014 17:42:19 -0500 Subject: 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. --- .../java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java index 15e114df..2fe10005 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/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; } -- cgit v1.2.3