public class GlowPlayerProfile extends Object implements com.destroystokyo.paper.profile.PlayerProfile
Modifier and Type | Field and Description |
---|---|
static int |
MAX_USERNAME_LENGTH |
Constructor and Description |
---|
GlowPlayerProfile(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.
|
Modifier and Type | Method and Description |
---|---|
void |
clearProperties() |
boolean |
complete()
Looks up the UUID if it's missing and hasn't already been attempted, and waits for it.
|
boolean |
complete(boolean textures) |
void |
completeAsync()
Looks up the UUID asynchronously if it's missing and hasn't already been attempted.
|
boolean |
completeCached()
Looks up the UUID in cache, if it's missing and hasn't already been attempted.
|
boolean |
completeFromCache() |
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.
|
UUID |
getId() |
UUID |
getIdBlocking()
Waits for the lookup of, then returns, the player's UUID.
|
String |
getName() |
static CompletableFuture<GlowPlayerProfile> |
getProfile(String name)
Get the profile for a username.
|
Set<com.destroystokyo.paper.profile.ProfileProperty> |
getProperties() |
boolean |
hasProperty(String property) |
boolean |
isComplete() |
boolean |
removeProperties(Collection<com.destroystokyo.paper.profile.ProfileProperty> properties) |
boolean |
removeProperty(com.destroystokyo.paper.profile.ProfileProperty property) |
boolean |
removeProperty(String name) |
UUID |
setId(UUID uuid) |
String |
setName(String name) |
void |
setProperties(Collection<com.destroystokyo.paper.profile.ProfileProperty> properties) |
void |
setProperty(com.destroystokyo.paper.profile.ProfileProperty property) |
CompoundTag |
toNbt()
Converts this player profile to an NBT compound tag.
|
public static final int MAX_USERNAME_LENGTH
public GlowPlayerProfile(String name, UUID uuid, boolean asyncLookup)
This does not try to resolve the name if it's null.
name
- The player's name.uuid
- The player's UUID; may be null.asyncLookup
- If true and uuid
is null, the UUID is looked up asynchronously.public GlowPlayerProfile(String name, UUID uuid, Collection<com.destroystokyo.paper.profile.ProfileProperty> properties, boolean asyncLookup)
This does not try to resolve the name if it's null.
name
- The player's name.uuid
- The player's UUID; may be null.properties
- A list of extra properties.asyncLookup
- If true and uuid
is null, the UUID is looked up asynchronously
even if it's not in cache.IllegalArgumentException
- if properties are null.public static CompletableFuture<GlowPlayerProfile> getProfile(String name)
name
- The username to lookup.public static CompletableFuture<GlowPlayerProfile> fromNbt(CompoundTag tag)
tag
- The NBT tag containing profile information.public static GlowPlayerProfile fromJson(org.json.simple.JSONObject json)
json
- a player profile in JSON formjson
as a GlowPlayerProfilepublic CompoundTag toNbt()
public String setName(@Nullable String name)
setName
in interface com.destroystokyo.paper.profile.PlayerProfile
public UUID getId()
getId
in interface com.destroystokyo.paper.profile.PlayerProfile
public UUID setId(@Nullable UUID uuid)
setId
in interface com.destroystokyo.paper.profile.PlayerProfile
public UUID getIdBlocking()
public Set<com.destroystokyo.paper.profile.ProfileProperty> getProperties()
getProperties
in interface com.destroystokyo.paper.profile.PlayerProfile
public boolean hasProperty(String property)
hasProperty
in interface com.destroystokyo.paper.profile.PlayerProfile
public void setProperty(com.destroystokyo.paper.profile.ProfileProperty property)
setProperty
in interface com.destroystokyo.paper.profile.PlayerProfile
public void setProperties(Collection<com.destroystokyo.paper.profile.ProfileProperty> properties)
setProperties
in interface com.destroystokyo.paper.profile.PlayerProfile
public boolean removeProperty(String name)
removeProperty
in interface com.destroystokyo.paper.profile.PlayerProfile
public boolean removeProperty(com.destroystokyo.paper.profile.ProfileProperty property)
removeProperty
in interface com.destroystokyo.paper.profile.PlayerProfile
public boolean removeProperties(Collection<com.destroystokyo.paper.profile.ProfileProperty> properties)
removeProperties
in interface com.destroystokyo.paper.profile.PlayerProfile
public void clearProperties()
clearProperties
in interface com.destroystokyo.paper.profile.PlayerProfile
public boolean isComplete()
A player profile that's currently incomplete may become complete later, because UUIDs are looked up asynchronously when needed.
isComplete
in interface com.destroystokyo.paper.profile.PlayerProfile
public boolean completeFromCache()
completeFromCache
in interface com.destroystokyo.paper.profile.PlayerProfile
public boolean complete()
complete
in interface com.destroystokyo.paper.profile.PlayerProfile
isComplete()
when done; false otherwisepublic boolean complete(boolean textures)
complete
in interface com.destroystokyo.paper.profile.PlayerProfile
public void completeAsync()
public boolean completeCached()
isComplete()
when done; false otherwiseCopyright © 2021. All rights reserved.