Class GlowPlayerProfile

java.lang.Object
net.glowstone.entity.meta.profile.GlowPlayerProfile
All Implemented Interfaces:
com.destroystokyo.paper.profile.PlayerProfile

public class GlowPlayerProfile extends Object implements com.destroystokyo.paper.profile.PlayerProfile
Information about a player's name, UUID, and other properties.
  • Field Details

  • Constructor Details

    • GlowPlayerProfile

      public GlowPlayerProfile(String name, UUID uuid, boolean asyncLookup)
      Construct a new profile with only a name and UUID.

      This does not try to resolve the name if it's null.

      Parameters:
      name - The player's name.
      uuid - The player's UUID; may be null.
      asyncLookup - If true and uuid is null, the UUID is looked up asynchronously.
    • GlowPlayerProfile

      public GlowPlayerProfile(String name, UUID uuid, Collection<com.destroystokyo.paper.profile.ProfileProperty> properties, boolean asyncLookup)
      Construct a new profile with additional properties.

      This does not try to resolve the name if it's null.

      Parameters:
      name - The player's name.
      uuid - The player's UUID; may be null.
      properties - A list of extra properties.
      asyncLookup - If true and uuid is null, the UUID is looked up asynchronously even if it's not in cache.
      Throws:
      IllegalArgumentException - if properties are null.
  • Method Details

    • getProfile

      public static CompletableFuture<GlowPlayerProfile> getProfile(String name)
      Get the profile for a username.
      Parameters:
      name - The username to lookup.
      Returns:
      A GlowPlayerProfile future. May be null if the name could not be resolved.
    • fromNbt

      public static CompletableFuture<GlowPlayerProfile> fromNbt(CompoundTag tag)
      Get the profile from a NBT tag (e.g. skulls). Missing information is fetched asynchronously.
      Parameters:
      tag - The NBT tag containing profile information.
      Returns:
      A GlowPlayerProfile future. May contain a null name if the lookup failed.
    • fromJson

      public static GlowPlayerProfile fromJson(org.json.simple.JSONObject json)
      Reads a GlowPlayerProfile from a JSON object.
      Parameters:
      json - a player profile in JSON form
      Returns:
      json as a GlowPlayerProfile
    • toNbt

      public CompoundTag toNbt()
      Converts this player profile to an NBT compound tag.
      Returns:
      an NBT compound tag that's a copy of this player profile
    • setName

      public String setName(@Nullable String name)
      Specified by:
      setName in interface com.destroystokyo.paper.profile.PlayerProfile
    • getId

      public UUID getId()
      Specified by:
      getId in interface com.destroystokyo.paper.profile.PlayerProfile
    • setId

      public UUID setId(@Nullable UUID uuid)
      Specified by:
      setId in interface com.destroystokyo.paper.profile.PlayerProfile
    • getIdBlocking

      public UUID getIdBlocking()
      Waits for the lookup of, then returns, the player's UUID.
      Returns:
      the player UUID, or null if it's unknown and couldn't be looked up
    • getProperties

      public Set<com.destroystokyo.paper.profile.ProfileProperty> getProperties()
      Specified by:
      getProperties in interface com.destroystokyo.paper.profile.PlayerProfile
    • setProperties

      public void setProperties(Collection<com.destroystokyo.paper.profile.ProfileProperty> properties)
      Specified by:
      setProperties in interface com.destroystokyo.paper.profile.PlayerProfile
    • hasProperty

      public boolean hasProperty(String property)
      Specified by:
      hasProperty in interface com.destroystokyo.paper.profile.PlayerProfile
    • setProperty

      public void setProperty(com.destroystokyo.paper.profile.ProfileProperty property)
      Specified by:
      setProperty in interface com.destroystokyo.paper.profile.PlayerProfile
    • removeProperty

      public boolean removeProperty(String name)
      Specified by:
      removeProperty in interface com.destroystokyo.paper.profile.PlayerProfile
    • removeProperty

      public boolean removeProperty(com.destroystokyo.paper.profile.ProfileProperty property)
      Specified by:
      removeProperty in interface com.destroystokyo.paper.profile.PlayerProfile
    • removeProperties

      public boolean removeProperties(Collection<com.destroystokyo.paper.profile.ProfileProperty> properties)
      Specified by:
      removeProperties in interface com.destroystokyo.paper.profile.PlayerProfile
    • clearProperties

      public void clearProperties()
      Specified by:
      clearProperties in interface com.destroystokyo.paper.profile.PlayerProfile
    • isComplete

      public boolean isComplete()

      A player profile that's currently incomplete may become complete later, because UUIDs are looked up asynchronously when needed.

      Specified by:
      isComplete in interface com.destroystokyo.paper.profile.PlayerProfile
    • completeFromCache

      public boolean completeFromCache()
      Specified by:
      completeFromCache in interface com.destroystokyo.paper.profile.PlayerProfile
    • completeFromCache

      public boolean completeFromCache(boolean onlineMode)
      Specified by:
      completeFromCache in interface com.destroystokyo.paper.profile.PlayerProfile
    • completeFromCache

      public boolean completeFromCache(boolean lookupUuid, boolean onlineMode)
      Specified by:
      completeFromCache in interface com.destroystokyo.paper.profile.PlayerProfile
    • complete

      public boolean complete()
      Looks up the UUID if it's missing and hasn't already been attempted, and waits for it.
      Specified by:
      complete in interface com.destroystokyo.paper.profile.PlayerProfile
      Returns:
      true if the profile isComplete() when done; false otherwise
    • complete

      public boolean complete(boolean textures)
      Specified by:
      complete in interface com.destroystokyo.paper.profile.PlayerProfile
    • complete

      public boolean complete(boolean textures, boolean onlineMode)
      Specified by:
      complete in interface com.destroystokyo.paper.profile.PlayerProfile
    • completeAsync

      public void completeAsync()
      Looks up the UUID asynchronously if it's missing and hasn't already been attempted. Returns immediately.
    • completeCached

      public boolean completeCached()
      Looks up the UUID in cache, if it's missing and hasn't already been attempted.
      Returns:
      true if the profile isComplete() when done; false otherwise
    • getName

      @Nullable public String getName()
      Specified by:
      getName in interface com.destroystokyo.paper.profile.PlayerProfile