Package com.velocitypowered.api.util
Class GameProfile
- java.lang.Object
-
- com.velocitypowered.api.util.GameProfile
-
public final class GameProfile extends java.lang.Object
Represents a Mojang game profile. This class is immutable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GameProfile.Property
Represents a Mojang profile property.
-
Constructor Summary
Constructors Constructor Description GameProfile(java.lang.String undashedId, java.lang.String name, java.util.List<GameProfile.Property> properties)
Creates a new Mojang game profile.GameProfile(java.util.UUID id, java.lang.String name, java.util.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 GameProfile
addProperties(java.lang.Iterable<GameProfile.Property> properties)
Creates a newGameProfile
with the properties of this object plus the specified properties.GameProfile
addProperty(GameProfile.Property property)
Creates a newGameProfile
with the properties of this object plus the specified property.static GameProfile
forOfflinePlayer(java.lang.String username)
Creates a game profile suitable for use in offline-mode.java.util.UUID
getId()
Returns the UUID associated with this game profile.java.lang.String
getName()
Returns the username associated with this profile.java.util.List<GameProfile.Property>
getProperties()
Returns an immutable list of profile properties associated with this profile.java.lang.String
getUndashedId()
Returns the undashed, Mojang-style UUID.java.lang.String
toString()
GameProfile
withId(java.util.UUID id)
Creates a newGameProfile
with the specified unique id.GameProfile
withName(java.lang.String name)
Creates a newGameProfile
with the specified name.GameProfile
withProperties(java.util.List<GameProfile.Property> properties)
Creates a newGameProfile
with the specified properties.GameProfile
withUndashedId(java.lang.String undashedId)
Creates a newGameProfile
with the specified undashed id.
-
-
-
Constructor Detail
-
GameProfile
public GameProfile(java.util.UUID id, java.lang.String name, java.util.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(java.lang.String undashedId, java.lang.String name, java.util.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
-
getUndashedId
public java.lang.String getUndashedId()
Returns the undashed, Mojang-style UUID.- Returns:
- the undashed UUID
-
getId
public java.util.UUID getId()
Returns the UUID associated with this game profile.- Returns:
- the UUID
-
getName
public java.lang.String getName()
Returns the username associated with this profile.- Returns:
- the username
-
getProperties
public java.util.List<GameProfile.Property> getProperties()
Returns an immutable list of profile properties associated with this profile.- Returns:
- the properties associated with this profile
-
withId
public GameProfile withId(java.util.UUID id)
Creates a newGameProfile
with the specified unique id.- Parameters:
id
- the new unique id- Returns:
- the new
GameProfile
-
withUndashedId
public GameProfile withUndashedId(java.lang.String undashedId)
Creates a newGameProfile
with the specified undashed id.- Parameters:
undashedId
- the new undashed id- Returns:
- the new
GameProfile
-
withName
public GameProfile withName(java.lang.String name)
Creates a newGameProfile
with the specified name.- Parameters:
name
- the new name- Returns:
- the new
GameProfile
-
withProperties
public GameProfile withProperties(java.util.List<GameProfile.Property> properties)
Creates a newGameProfile
with the specified properties.- Parameters:
properties
- the new properties- Returns:
- the new
GameProfile
-
addProperties
public GameProfile addProperties(java.lang.Iterable<GameProfile.Property> properties)
Creates a newGameProfile
with 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 newGameProfile
with the properties of this object plus the specified property.- Parameters:
property
- the property to add- Returns:
- the new
GameProfile
-
forOfflinePlayer
public static GameProfile forOfflinePlayer(java.lang.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
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-