Class WrappedGameProfile

java.lang.Object
com.comphenix.protocol.wrappers.AbstractWrapper
com.comphenix.protocol.wrappers.WrappedGameProfile

public class WrappedGameProfile extends AbstractWrapper
Represents a wrapper for a game profile.
  • Field Details

    • REPORT_INVALID_UUID

      public static final ReportType REPORT_INVALID_UUID
  • Constructor Details

    • WrappedGameProfile

      @Deprecated public WrappedGameProfile(String id, String name)
      Deprecated.
      Construct a new game profile with the given properties.

      Note that this constructor is very lenient when parsing UUIDs for backwards compatibility reasons. IDs that cannot be parsed as an UUID will be hashed and form a version 3 UUID instead.

      This method is deprecated for Minecraft 1.7.8 and above.

      Parameters:
      id - - the UUID of the player.
      name - - the name of the player.
    • WrappedGameProfile

      public WrappedGameProfile(UUID uuid, String name)
      Construct a new game profile with the given properties.

      Note that at least one of the parameters must be non-null.

      Parameters:
      uuid - - the UUID of the player, or NULL.
      name - - the name of the player, or NULL.
  • Method Details

    • fromPlayer

      public static WrappedGameProfile fromPlayer(org.bukkit.entity.Player player)
      Retrieve the associated game profile of a player.

      Note that this may not exist in the current Minecraft version.

      Parameters:
      player - - the player.
      Returns:
      The game profile.
    • fromOfflinePlayer

      public static WrappedGameProfile fromOfflinePlayer(org.bukkit.OfflinePlayer player)
      Retrieve the associated game profile of an offline player.

      Note that this may not exist in the current Minecraft version.

      Parameters:
      player - - the offline player.
      Returns:
      The game profile.
    • fromHandle

      public static WrappedGameProfile fromHandle(Object handle)
      Construct a wrapper around an existing game profile.
      Parameters:
      handle - - the underlying profile, or NULL.
      Returns:
      A wrapper around an existing game profile.
    • getUUID

      public UUID getUUID()
      Retrieve the UUID of the player.

      Note that Minecraft 1.7.5 and earlier doesn't use UUIDs internally, and it may not be possible to convert the string to an UUID.

      We use the same lax conversion as in WrappedGameProfile(String, String).

      Returns:
      The UUID, or NULL if the UUID is NULL.
      Throws:
      IllegalStateException - If we cannot parse the internal ID as an UUID.
    • getId

      public String getId()
      Retrieve the textual representation of the player's UUID.

      Note that there's nothing stopping plugins from creating non-standard UUIDs.

      In Minecraft 1.7.8 and later, this simply returns the string form of getUUID().

      Returns:
      The UUID of the player, or NULL if not computed.
    • getName

      public String getName()
      Retrieve the name of the player.
      Returns:
      The player name.
    • getProperties

      public com.google.common.collect.Multimap<String,WrappedSignedProperty> getProperties()
      Retrieve the property map of signed values.
      Returns:
      Property map.
    • withName

      public WrappedGameProfile withName(String name)
      Construct a new game profile with the same ID, but different name.
      Parameters:
      name - - the new name of the profile to create.
      Returns:
      The new game profile.
    • withId

      public WrappedGameProfile withId(String id)
      Construct a new game profile with the same name, but different id.
      Parameters:
      id - - the new id of the profile to create.
      Returns:
      The new game profile.
    • isComplete

      public boolean isComplete()
      Determine if the game profile contains both an UUID and a name.
      Returns:
      TRUE if it does, FALSE otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class AbstractWrapper
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractWrapper
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class AbstractWrapper