#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

@@ -19,10 +19,12 @@ import org.bukkit.Server;
import org.bukkit.Statistic;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.SerializableAs;
import org.bukkit.craftbukkit.profile.CraftPlayerProfile;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.profile.PlayerProfile;
@SerializableAs("Player")
public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializable {
@@ -37,10 +39,6 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
}
public GameProfile getProfile() {
return profile;
}
@Override
public boolean isOnline() {
return getPlayer() != null;
@@ -74,6 +72,11 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
return profile.getId();
}
@Override
public PlayerProfile getPlayerProfile() {
return new CraftPlayerProfile(profile);
}
public Server getServer() {
return server;
}