Package com.velocitypowered.api.util
Class GameProfile
- java.lang.Object
-
- com.velocitypowered.api.util.GameProfile
-
- All Implemented Interfaces:
Identified,Identity,net.kyori.examination.Examinable
public final class GameProfile extends Object implements Identified, Identity
Represents a Mojang game profile. This class is immutable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGameProfile.PropertyRepresents a Mojang profile property.
-
Constructor Summary
Constructors Constructor Description GameProfile(String undashedId, String name, List<GameProfile.Property> properties)Creates a new Mojang game profile.GameProfile(UUID id, String name, List<GameProfile.Property> properties)Creates a new Mojang game profile.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GameProfileaddProperties(Iterable<GameProfile.Property> properties)Creates a newGameProfilewith the properties of this object plus the specified properties.GameProfileaddProperty(GameProfile.Property property)Creates a newGameProfilewith the properties of this object plus the specified property.static GameProfileforOfflinePlayer(String username)Creates a game profile suitable for use in offline-mode.@NonNull Identityidentity()Stringname()Returns the username associated with this profile.List<GameProfile.Property>properties()Returns an immutable list of profile properties associated with this profile.StringtoString()StringundashedId()Returns the undashed, Mojang-style UUID.@NotNull UUIDuuid()Returns the UUID associated with this game profile.GameProfilewithName(String name)Creates a newGameProfilewith the specified name.GameProfilewithProperties(List<GameProfile.Property> properties)Creates a newGameProfilewith the specified properties.GameProfilewithUndashedId(String undashedId)Creates a newGameProfilewith the specified undashed id.GameProfilewithUuid(UUID id)Creates a newGameProfilewith the specified unique id.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.kyori.adventure.identity.Identity
examinableProperties
-
-
-
-
Constructor Detail
-
GameProfile
public GameProfile(UUID id, String name, List<GameProfile.Property> properties)
Creates a new Mojang game profile.- Parameters:
id- the UUID for the profilename- the profile's usernameproperties- properties for the profile
-
GameProfile
public GameProfile(String undashedId, String name, List<GameProfile.Property> properties)
Creates a new Mojang game profile.- Parameters:
undashedId- the undashed, Mojang-style UUID for the profilename- the profile's usernameproperties- properties for the profile
-
-
Method Detail
-
undashedId
public String undashedId()
Returns the undashed, Mojang-style UUID.- Returns:
- the undashed UUID
-
uuid
@NotNull public @NotNull UUID uuid()
Returns the UUID associated with this game profile.
-
name
public String name()
Returns the username associated with this profile.- Returns:
- the username
-
properties
public List<GameProfile.Property> properties()
Returns an immutable list of profile properties associated with this profile.- Returns:
- the properties associated with this profile
-
withUuid
public GameProfile withUuid(UUID id)
Creates a newGameProfilewith the specified unique id.- Parameters:
id- the new unique id- Returns:
- the new
GameProfile
-
withUndashedId
public GameProfile withUndashedId(String undashedId)
Creates a newGameProfilewith the specified undashed id.- Parameters:
undashedId- the new undashed id- Returns:
- the new
GameProfile
-
withName
public GameProfile withName(String name)
Creates a newGameProfilewith the specified name.- Parameters:
name- the new name- Returns:
- the new
GameProfile
-
withProperties
public GameProfile withProperties(List<GameProfile.Property> properties)
Creates a newGameProfilewith the specified properties.- Parameters:
properties- the new properties- Returns:
- the new
GameProfile
-
addProperties
public GameProfile addProperties(Iterable<GameProfile.Property> properties)
Creates a newGameProfilewith the properties of this object plus the specified properties.- Parameters:
properties- the properties to add- Returns:
- the new
GameProfile
-
addProperty
public GameProfile addProperty(GameProfile.Property property)
Creates a newGameProfilewith the properties of this object plus the specified property.- Parameters:
property- the property to add- Returns:
- the new
GameProfile
-
forOfflinePlayer
public static GameProfile forOfflinePlayer(String username)
Creates a game profile suitable for use in offline-mode.- Parameters:
username- the username to use- Returns:
- the new offline-mode game profile
-
identity
public @NonNull Identity identity()
- Specified by:
identityin interfaceIdentified
-
-