SPIGOT-4348: Use online player for setting skull owner if possible

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2018-09-06 20:47:37 +10:00
parent 4f9972bcac
commit eeb96c0247
2 changed files with 14 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Skull;
import org.bukkit.block.data.Rotatable;
import org.bukkit.craftbukkit.entity.CraftPlayer;
public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implements Skull {
@@ -96,7 +97,11 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
public void setOwningPlayer(OfflinePlayer player) {
Preconditions.checkNotNull(player, "player");
this.profile = new GameProfile(player.getUniqueId(), player.getName());
if (player instanceof CraftPlayer) {
this.profile = ((CraftPlayer) player).getProfile();
} else {
this.profile = new GameProfile(player.getUniqueId(), player.getName());
}
}
@Override