Class GameProfile


  • public final class GameProfile
    extends Object
    Represents a Mojang game profile. This class is immutable.
    • 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 profile
        name - the profile's username
        properties - 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 profile
        name - the profile's username
        properties - properties for the profile
    • Method Detail

      • getUndashedId

        public String getUndashedId()
        Returns the undashed, Mojang-style UUID.
        Returns:
        the undashed UUID
      • getId

        public UUID getId()
        Returns the UUID associated with this game profile.
        Returns:
        the UUID
      • getName

        public String getName()
        Returns the username associated with this profile.
        Returns:
        the username
      • getProperties

        public 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​(UUID id)
        Creates a new GameProfile with the specified unique id.
        Parameters:
        id - the new unique id
        Returns:
        the new GameProfile
      • withUndashedId

        public GameProfile withUndashedId​(String undashedId)
        Creates a new GameProfile with the specified undashed id.
        Parameters:
        undashedId - the new undashed id
        Returns:
        the new GameProfile
      • withName

        public GameProfile withName​(String name)
        Creates a new GameProfile with the specified name.
        Parameters:
        name - the new name
        Returns:
        the new GameProfile
      • withProperties

        public GameProfile withProperties​(List<GameProfile.Property> properties)
        Creates a new GameProfile with the specified properties.
        Parameters:
        properties - the new properties
        Returns:
        the new GameProfile
      • addProperties

        public GameProfile addProperties​(Iterable<GameProfile.Property> properties)
        Creates a new GameProfile 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 new GameProfile 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​(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