geforkt von Mirrors/Paper
SPIGOT-4348: Use online player for setting skull owner if possible
Dieser Commit ist enthalten in:
Ursprung
c88ae6b195
Commit
3eb8af2340
@ -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,8 +97,12 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
|
||||
public void setOwningPlayer(OfflinePlayer player) {
|
||||
Preconditions.checkNotNull(player, "player");
|
||||
|
||||
if (player instanceof CraftPlayer) {
|
||||
this.profile = ((CraftPlayer) player).getProfile();
|
||||
} else {
|
||||
this.profile = new GameProfile(player.getUniqueId(), player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFace getRotation() {
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.serialization.DelegateDeserialization;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftMetaItem.SerializableMeta;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
@ -159,7 +160,13 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
|
||||
@Override
|
||||
public boolean setOwningPlayer(OfflinePlayer owner) {
|
||||
profile = (owner == null) ? null : new GameProfile(owner.getUniqueId(), owner.getName());
|
||||
if (owner == null) {
|
||||
profile = null;
|
||||
} else if (owner instanceof CraftPlayer) {
|
||||
profile = ((CraftPlayer) owner).getProfile();
|
||||
} else {
|
||||
profile = new GameProfile(owner.getUniqueId(), owner.getName());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren