SPIGOT-249: Set skull owner by UUID

Dieser Commit ist enthalten in:
md_5 2016-06-01 21:39:49 +10:00
Ursprung a28041daa7
Commit 0cd0397a82

Datei anzeigen

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