Package com.destroystokyo.paper.profile

# Interface PlayerProfile

All Superinterfaces:
  `Cloneable`, `ConfigurationSerializable`, `PlayerProfile`

public interface PlayerProfile extends PlayerProfile
Represents a players profile for the game, such as UUID, Name, and textures.

## Method Summary

Modifier and Type
Method
Description
`void`
`clearProperties()`
Clears all properties on this profile
`default boolean`
`complete()`
If this profile is not complete, then make the API call to complete it.
`boolean`
`complete(boolean textures)`
If this profile is not complete, then make the API call to complete it.
`boolean`
`complete(boolean textures, boolean onlineMode)`
If this profile is not complete, then make the API call to complete it.
`boolean`
`completeFromCache()`
Like `complete(boolean)` but will try only from cache, and not make network calls Does not account for textures.
`boolean`
`completeFromCache(boolean onlineMode)`
Like `complete(boolean)` but will try only from cache, and not make network calls Does not account for textures.
`boolean`
`completeFromCache(boolean lookupUUID, boolean onlineMode)`
Like `complete(boolean)` but will try only from cache, and not make network calls Does not account for textures.
`@Nullable UUID`
`getId()`
`@Nullable String`
`getName()`
Gets the player name.
`@NotNull Set<ProfileProperty>`
`getProperties()`
`@NotNull PlayerTextures`
`getTextures()`
Gets the `PlayerTextures` of this profile.
`boolean`
`hasProperty(@Nullable String property)`
Check if the Profile has the specified property
`default boolean`
`hasTextures()`
Whether this Profile has textures associated to it
`boolean`
`isComplete()`
Checks whether this profile is complete.
`default boolean`
`removeProperties(@NotNull Collection<ProfileProperty> properties)`
Removes all properties in the collection
`default boolean`
`removeProperty(@NotNull ProfileProperty property)`
Removes a specific property from this profile
`boolean`
`removeProperty(@Nullable String property)`
Removes a specific property from this profile
`@Nullable UUID`
`setId(@Nullable UUID uuid)`
Deprecated, for removal: This API element is subject to removal in a future version.
`@NotNull String`
`setName(@Nullable String name)`
Deprecated, for removal: This API element is subject to removal in a future version.
`void`
`setProperties(@NotNull Collection<ProfileProperty> properties)`
Sets multiple properties.
`void`
`setProperty(@NotNull ProfileProperty property)`
Sets a property.
`void`
`setTextures(@Nullable PlayerTextures textures)`
Copies the given textures.
`@NotNull CompletableFuture<PlayerProfile>`
`update()`
Produces an updated player profile based on this profile.

### Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable

`serialize`

### Methods inherited from interface org.bukkit.profile.PlayerProfile

`clone, getUniqueId`

## Method Details

### getName

@Nullable @Nullable String getName()
Description copied from interface: `PlayerProfile`
Gets the player name.

Specified by:
  `getName` in interface `PlayerProfile`
Returns:
  The players name, if set

### setName

@NotNull @Deprecated(forRemoval=true) @NotNull String setName(@Nullable @Nullable String name)
Deprecated, for removal: This API element is subject to removal in a future version.
Sets this profiles Name

Parameters:
  `name` - The new Name
Returns:
  The previous Name

### getId

@Nullable @Nullable UUID getId()

Returns:
  The players unique identifier, if set

### setId

@Nullable @Deprecated(forRemoval=true) @Nullable UUID setId(@Nullable @Nullable UUID uuid)
Deprecated, for removal: This API element is subject to removal in a future version.
Sets this profiles UUID

Parameters:
  `uuid` - The new UUID
Returns:
  The previous UUID

### getTextures

@NotNull @NotNull PlayerTextures getTextures()
Gets the `PlayerTextures` of this profile. This will build a snapshot of the current texture data once requested inside PlayerTextures.

Specified by:
  `getTextures` in interface `PlayerProfile`
Returns:
  the textures, not `null`

### setTextures

void setTextures(@Nullable @Nullable PlayerTextures textures)
Copies the given textures.

Specified by:
  `setTextures` in interface `PlayerProfile`
Parameters:
  `textures` - the textures to copy, or `null` to clear the textures

### getProperties

@NotNull @NotNull Set<ProfileProperty> getProperties()

Returns:
  A Mutable set of this players properties, such as textures. Values specified here are subject to implementation details.

### hasProperty

boolean hasProperty(@Nullable @Nullable String property)
Check if the Profile has the specified property

Parameters:
  `property` - Property name to check
Returns:
  If the property is set

### setProperty

void setProperty(@NotNull @NotNull ProfileProperty property)
Sets a property. If the property already exists, the previous one will be replaced

Parameters:
  `property` - Property to set.

### setProperties

void setProperties(@NotNull @NotNull Collection<ProfileProperty> properties)
Sets multiple properties. If any of the set properties already exist, it will be replaced

Parameters:
  `properties` - The properties to set

### removeProperty

boolean removeProperty(@Nullable @Nullable String property)
Removes a specific property from this profile

Parameters:
  `property` - The property to remove
Returns:
  If a property was removed

### removeProperty

default boolean removeProperty(@NotNull @NotNull ProfileProperty property)
Removes a specific property from this profile

Parameters:
  `property` - The property to remove
Returns:
  If a property was removed

### removeProperties

default boolean removeProperties(@NotNull @NotNull Collection<ProfileProperty> properties)
Removes all properties in the collection

Parameters:
  `properties` - The properties to remove
Returns:
  If any property was removed

### clearProperties

void clearProperties()
Clears all properties on this profile

### isComplete

boolean isComplete()
Description copied from interface: `PlayerProfile`
Checks whether this profile is complete.

A profile is currently considered complete if it has a name, a unique id, and textures.

Specified by:
  `isComplete` in interface `PlayerProfile`
Returns:
  If the profile is now complete (has UUID and Name)

### completeFromCache

boolean completeFromCache()
Like `complete(boolean)` but will try only from cache, and not make network calls Does not account for textures.

Returns:
  If the profile is now complete (has UUID and Name)

### completeFromCache

boolean completeFromCache(boolean onlineMode)
Like `complete(boolean)` but will try only from cache, and not make network calls Does not account for textures.

Parameters:
  `onlineMode` - Treat this as online mode or not
Returns:
  If the profile is now complete (has UUID and Name)

### completeFromCache

boolean completeFromCache(boolean lookupUUID, boolean onlineMode)
Like `complete(boolean)` but will try only from cache, and not make network calls Does not account for textures.

Parameters:
  `lookupUUID` - If only name is supplied, should we do a UUID lookup
  `onlineMode` - Treat this as online mode or not
Returns:
  If the profile is now complete (has UUID and Name)

### complete

default boolean complete()
If this profile is not complete, then make the API call to complete it. This is a blocking operation and should be done asynchronously. This will also complete textures. If you do not want to load textures, use {`complete(boolean)`}

Returns:
  If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)

### complete

boolean complete(boolean textures)
If this profile is not complete, then make the API call to complete it. This is a blocking operation and should be done asynchronously. Optionally will also fill textures. Online mode will be automatically determined

Parameters:
  `textures` - controls if we should fill the profile with texture properties
Returns:
  If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)

### complete

boolean complete(boolean textures, boolean onlineMode)
If this profile is not complete, then make the API call to complete it. This is a blocking operation and should be done asynchronously. Optionally will also fill textures.

Parameters:
  `textures` - controls if we should fill the profile with texture properties
  `onlineMode` - Treat this server as online mode or not
Returns:
  If the profile is now complete (has UUID and Name) (if you get rate limited, this operation may fail)

### update

@NotNull @NotNull CompletableFuture<PlayerProfile> update()
Produces an updated player profile based on this profile.

This tries to produce a completed profile by filling in missing properties (name, unique id, textures, etc.), and updates existing properties (e.g. name, textures, etc.) to their official and up-to-date values. This operation does not alter the current profile, but produces a new updated `PlayerProfile`.

If no player exists for the unique id or name of this profile, this operation yields a profile that is equal to the current profile, which might not be complete.

This is an asynchronous operation: Updating the profile can result in an outgoing connection in another thread in order to fetch the latest profile properties. The returned `CompletableFuture` will be completed once the updated profile is available. In order to not block the server's main thread, you should not wait for the result of the returned CompletableFuture on the server's main thread. Instead, if you want to do something with the updated player profile on the server's main thread once it is available, you could do something like this:

     profile.update().thenAcceptAsync(updatedProfile -> {
         // Do something with the updated profile:
         // ...
     }, runnable -> Bukkit.getScheduler().runTask(plugin, runnable));

Specified by:
  `update` in interface `PlayerProfile`
Returns:
  a completable future that gets completed with the updated PlayerProfile once it is available

### hasTextures

default boolean hasTextures()
Whether this Profile has textures associated to it

Returns:
  If it has a textures property