#1002: Add Player Profile API

Slight changes may occur as this API is stabilized.

This PR is based on work previously done by DerFrZocker in #938.

By: blablubbabc <lukas@wirsindwir.de>
This commit is contained in:
CraftBukkit/Spigot
2022-02-03 09:25:39 +11:00
parent 0190fa68f9
commit 08891a2e2f
11 changed files with 1159 additions and 6 deletions

View File

@@ -14,6 +14,8 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.Rotatable;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.profile.CraftPlayerProfile;
import org.bukkit.profile.PlayerProfile;
public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implements Skull {
@@ -100,6 +102,24 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
}
}
@Override
public PlayerProfile getOwnerProfile() {
if (!hasOwner()) {
return null;
}
return new CraftPlayerProfile(profile);
}
@Override
public void setOwnerProfile(PlayerProfile profile) {
if (profile == null) {
this.profile = null;
} else {
this.profile = CraftPlayerProfile.validateSkullProfile(((CraftPlayerProfile) profile).buildGameProfile());
}
}
@Override
public BlockFace getRotation() {
BlockData blockData = getBlockData();