3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00

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.
Dieser Commit ist enthalten in:
Travis Watkins 2014-05-03 17:42:19 -05:00
Ursprung 33e472229e
Commit 690a908b97

Datei anzeigen

@ -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;
}