Class GlowPlayerProfile
java.lang.Object
net.glowstone.entity.meta.profile.GlowPlayerProfile
- All Implemented Interfaces:
com.destroystokyo.paper.profile.PlayerProfile
public class GlowPlayerProfile
extends Object
implements com.destroystokyo.paper.profile.PlayerProfile
Information about a player's name, UUID, and other properties.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGlowPlayerProfile
(String name, UUID uuid, boolean asyncLookup) Construct a new profile with only a name and UUID.GlowPlayerProfile
(String name, UUID uuid, Collection<com.destroystokyo.paper.profile.ProfileProperty> properties, boolean asyncLookup) Construct a new profile with additional properties. -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
complete()
Looks up the UUID if it's missing and hasn't already been attempted, and waits for it.boolean
complete
(boolean textures) boolean
complete
(boolean textures, boolean onlineMode) void
Looks up the UUID asynchronously if it's missing and hasn't already been attempted.boolean
Looks up the UUID in cache, if it's missing and hasn't already been attempted.boolean
boolean
completeFromCache
(boolean onlineMode) boolean
completeFromCache
(boolean lookupUuid, boolean onlineMode) static GlowPlayerProfile
fromJson
(org.json.simple.JSONObject json) Reads a GlowPlayerProfile from a JSON object.static CompletableFuture<GlowPlayerProfile>
fromNbt
(CompoundTag tag) Get the profile from a NBT tag (e.g.getId()
Waits for the lookup of, then returns, the player's UUID.getName()
static CompletableFuture<GlowPlayerProfile>
getProfile
(String name) Get the profile for a username.Set<com.destroystokyo.paper.profile.ProfileProperty>
boolean
hasProperty
(String property) boolean
boolean
removeProperties
(Collection<com.destroystokyo.paper.profile.ProfileProperty> properties) boolean
removeProperty
(com.destroystokyo.paper.profile.ProfileProperty property) boolean
removeProperty
(String name) void
setProperties
(Collection<com.destroystokyo.paper.profile.ProfileProperty> properties) void
setProperty
(com.destroystokyo.paper.profile.ProfileProperty property) toNbt()
Converts this player profile to an NBT compound tag.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.destroystokyo.paper.profile.PlayerProfile
hasTextures
-
Field Details
-
MAX_USERNAME_LENGTH
public static final int MAX_USERNAME_LENGTH- See Also:
-
-
Constructor Details
-
GlowPlayerProfile
Construct a new profile with only a name and UUID.This does not try to resolve the name if it's null.
- Parameters:
name
- The player's name.uuid
- The player's UUID; may be null.asyncLookup
- If true anduuid
is null, the UUID is looked up asynchronously.
-
GlowPlayerProfile
public GlowPlayerProfile(String name, UUID uuid, Collection<com.destroystokyo.paper.profile.ProfileProperty> properties, boolean asyncLookup) Construct a new profile with additional properties.This does not try to resolve the name if it's null.
- Parameters:
name
- The player's name.uuid
- The player's UUID; may be null.properties
- A list of extra properties.asyncLookup
- If true anduuid
is null, the UUID is looked up asynchronously even if it's not in cache.- Throws:
IllegalArgumentException
- if properties are null.
-
-
Method Details
-
getProfile
Get the profile for a username.- Parameters:
name
- The username to lookup.- Returns:
- A GlowPlayerProfile future. May be null if the name could not be resolved.
-
fromNbt
Get the profile from a NBT tag (e.g. skulls). Missing information is fetched asynchronously.- Parameters:
tag
- The NBT tag containing profile information.- Returns:
- A GlowPlayerProfile future. May contain a null name if the lookup failed.
-
fromJson
Reads a GlowPlayerProfile from a JSON object.- Parameters:
json
- a player profile in JSON form- Returns:
json
as a GlowPlayerProfile
-
toNbt
Converts this player profile to an NBT compound tag.- Returns:
- an NBT compound tag that's a copy of this player profile
-
setName
- Specified by:
setName
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
getId
- Specified by:
getId
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
setId
- Specified by:
setId
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
getIdBlocking
Waits for the lookup of, then returns, the player's UUID.- Returns:
- the player UUID, or null if it's unknown and couldn't be looked up
-
getProperties
- Specified by:
getProperties
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
setProperties
- Specified by:
setProperties
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
hasProperty
- Specified by:
hasProperty
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
setProperty
public void setProperty(com.destroystokyo.paper.profile.ProfileProperty property) - Specified by:
setProperty
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
removeProperty
- Specified by:
removeProperty
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
removeProperty
public boolean removeProperty(com.destroystokyo.paper.profile.ProfileProperty property) - Specified by:
removeProperty
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
removeProperties
public boolean removeProperties(Collection<com.destroystokyo.paper.profile.ProfileProperty> properties) - Specified by:
removeProperties
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
clearProperties
public void clearProperties()- Specified by:
clearProperties
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
isComplete
public boolean isComplete()A player profile that's currently incomplete may become complete later, because UUIDs are looked up asynchronously when needed.
- Specified by:
isComplete
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
completeFromCache
public boolean completeFromCache()- Specified by:
completeFromCache
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
completeFromCache
public boolean completeFromCache(boolean onlineMode) - Specified by:
completeFromCache
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
completeFromCache
public boolean completeFromCache(boolean lookupUuid, boolean onlineMode) - Specified by:
completeFromCache
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
complete
public boolean complete()Looks up the UUID if it's missing and hasn't already been attempted, and waits for it.- Specified by:
complete
in interfacecom.destroystokyo.paper.profile.PlayerProfile
- Returns:
- true if the profile
isComplete()
when done; false otherwise
-
complete
public boolean complete(boolean textures) - Specified by:
complete
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
complete
public boolean complete(boolean textures, boolean onlineMode) - Specified by:
complete
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-
completeAsync
public void completeAsync()Looks up the UUID asynchronously if it's missing and hasn't already been attempted. Returns immediately. -
completeCached
public boolean completeCached()Looks up the UUID in cache, if it's missing and hasn't already been attempted.- Returns:
- true if the profile
isComplete()
when done; false otherwise
-
getName
- Specified by:
getName
in interfacecom.destroystokyo.paper.profile.PlayerProfile
-