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 TypeMethodDescriptionvoidbooleancomplete()Looks up the UUID if it's missing and hasn't already been attempted, and waits for it.booleancomplete(boolean textures) booleancomplete(boolean textures, boolean onlineMode) voidLooks up the UUID asynchronously if it's missing and hasn't already been attempted.booleanLooks up the UUID in cache, if it's missing and hasn't already been attempted.booleanbooleancompleteFromCache(boolean onlineMode) booleancompleteFromCache(boolean lookupUuid, boolean onlineMode) static GlowPlayerProfilefromJson(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>booleanhasProperty(String property) booleanbooleanremoveProperties(Collection<com.destroystokyo.paper.profile.ProfileProperty> properties) booleanremoveProperty(com.destroystokyo.paper.profile.ProfileProperty property) booleanremoveProperty(String name) voidsetProperties(Collection<com.destroystokyo.paper.profile.ProfileProperty> properties) voidsetProperty(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, waitMethods 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 anduuidis 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 anduuidis 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:
jsonas 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:
setNamein interfacecom.destroystokyo.paper.profile.PlayerProfile
-
getId
- Specified by:
getIdin interfacecom.destroystokyo.paper.profile.PlayerProfile
-
setId
- Specified by:
setIdin 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:
getPropertiesin interfacecom.destroystokyo.paper.profile.PlayerProfile
-
setProperties
- Specified by:
setPropertiesin interfacecom.destroystokyo.paper.profile.PlayerProfile
-
hasProperty
- Specified by:
hasPropertyin interfacecom.destroystokyo.paper.profile.PlayerProfile
-
setProperty
public void setProperty(com.destroystokyo.paper.profile.ProfileProperty property) - Specified by:
setPropertyin interfacecom.destroystokyo.paper.profile.PlayerProfile
-
removeProperty
- Specified by:
removePropertyin interfacecom.destroystokyo.paper.profile.PlayerProfile
-
removeProperty
public boolean removeProperty(com.destroystokyo.paper.profile.ProfileProperty property) - Specified by:
removePropertyin interfacecom.destroystokyo.paper.profile.PlayerProfile
-
removeProperties
public boolean removeProperties(Collection<com.destroystokyo.paper.profile.ProfileProperty> properties) - Specified by:
removePropertiesin interfacecom.destroystokyo.paper.profile.PlayerProfile
-
clearProperties
public void clearProperties()- Specified by:
clearPropertiesin 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:
isCompletein interfacecom.destroystokyo.paper.profile.PlayerProfile
-
completeFromCache
public boolean completeFromCache()- Specified by:
completeFromCachein interfacecom.destroystokyo.paper.profile.PlayerProfile
-
completeFromCache
public boolean completeFromCache(boolean onlineMode) - Specified by:
completeFromCachein interfacecom.destroystokyo.paper.profile.PlayerProfile
-
completeFromCache
public boolean completeFromCache(boolean lookupUuid, boolean onlineMode) - Specified by:
completeFromCachein 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:
completein interfacecom.destroystokyo.paper.profile.PlayerProfile- Returns:
- true if the profile
isComplete()when done; false otherwise
-
complete
public boolean complete(boolean textures) - Specified by:
completein interfacecom.destroystokyo.paper.profile.PlayerProfile
-
complete
public boolean complete(boolean textures, boolean onlineMode) - Specified by:
completein 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:
getNamein interfacecom.destroystokyo.paper.profile.PlayerProfile
-