mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 11:27:35 +01:00
SPIGOT-249: Set skull owner by UUID
This commit is contained in:
parent
a28041daa7
commit
0cd0397a82
@ -1,9 +1,12 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.TileEntitySkull;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import org.bukkit.SkullType;
|
||||
import org.bukkit.block.Block;
|
||||
@ -176,6 +179,22 @@ public class CraftSkull extends CraftBlockState implements Skull {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfflinePlayer getOwningPlayer() {
|
||||
return hasOwner() ? Bukkit.getOfflinePlayer(profile.getId()) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwningPlayer(OfflinePlayer player) {
|
||||
Preconditions.checkNotNull(player, "player");
|
||||
|
||||
if (skullType != SkullType.PLAYER) {
|
||||
skullType = SkullType.PLAYER;
|
||||
}
|
||||
|
||||
this.profile = new GameProfile(player.getUniqueId(), player.getName());
|
||||
}
|
||||
|
||||
public BlockFace getRotation() {
|
||||
return getBlockFace(rotation);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user