Class SteamID


  • public class SteamID
    extends java.lang.Object
    This 64-bit structure is used for identifying various objects on the Steam network.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  SteamID.ChatInstanceFlags
      Represents various flags a chat SteamID may have, packed into its instance.
    • Constructor Summary

      Constructors 
      Constructor Description
      SteamID()  
      SteamID​(long id)
      Initializes a new instance of the SteamID class.
      SteamID​(long unAccountID, long unInstance, EUniverse eUniverse, EAccountType eAccountType)
      Initializes a new instance of the SteamID class.
      SteamID​(long unAccountID, EUniverse eUniverse, EAccountType eAccountType)  
      SteamID​(java.lang.String steamId)
      Initializes a new instance of the SteamID class from a Steam2 "STEAM_" rendered form.
      SteamID​(java.lang.String steamId, EUniverse eUniverse)
      Initializes a new instance of the SteamID class from a Steam2 "STEAM_" rendered form and universe.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long convertToUInt64()
      Converts this SteamID into it's 64bit integer form.
      boolean equals​(java.lang.Object obj)
      Determines whether the specified Object is equal to this instance.
      long getAccountID()  
      long getAccountInstance()  
      EAccountType getAccountType()  
      EUniverse getAccountUniverse()  
      long getStaticAccountKey()
      Returns a static account key used for grouping accounts with differing instances.
      int hashCode()
      Returns a hash code for this instance.
      void instancedSet​(long unAccountID, long unInstance, EUniverse eUniverse, EAccountType eAccountType)
      Sets the various components of this SteamID instance.
      boolean isAnonAccount()
      Gets a value indicating whether this instance is an anonymous account.
      boolean isAnonGameServerAccount()
      Gets a value indicating whether this instance is an anonymous game server account.
      boolean isAnonUserAccount()
      Gets a value indicating whether this instance is an anonymous user account.
      boolean isBlankAnonAccount()
      Gets a value indicating whether this instance is a game server account.
      boolean isChatAccount()
      Gets a value indicating whether this instance is a chat account.
      boolean isClanAccount()
      Gets a value indicating whether this instance is a clan account.
      boolean isConsoleUserAccount()
      Gets a value indicating whether this instance is a console user account.
      boolean isContentServerAccount()
      Gets a value indicating whether this instance is a content server account.
      boolean isGameServerAccount()
      Gets a value indicating whether this instance is a game server account.
      boolean isIndividualAccount()
      Gets a value indicating whether this instance is an individual account.
      boolean isLobby()
      Gets a value indicating whether this instance is a lobby.
      boolean isPersistentGameServerAccount()
      Gets a value indicating whether this instance is a persistent game server account.
      boolean isValid()
      Gets a value indicating whether this instance is valid.
      java.lang.String render()
      Renders this instance into it's Steam3 representation.
      java.lang.String render​(boolean steam3)
      Renders this instance into it's Steam2 "STEAM_" or Steam3 representation.
      void set​(long unAccountID, EUniverse eUniverse, EAccountType eAccountType)
      Sets the various components of this SteamID instance.
      void setAccountID​(long accountID)  
      void setAccountInstance​(long accountInstance)  
      void setAccountType​(EAccountType accountType)  
      void setAccountUniverse​(EUniverse accountUniverse)  
      boolean setFromSteam3String​(java.lang.String steamId)
      Sets the various components of this SteamID from a Steam3 "[X:1:2:3]" rendered form and universe.
      boolean setFromString​(java.lang.String steamId, EUniverse eUniverse)
      Sets the various components of this SteamID from a Steam2 "STEAM_" rendered form and universe.
      void setFromUInt64​(long longSteamId)
      Sets the various components of this SteamID from a 64bit integer form.
      SteamID toChatID()
      Converts this clan ID to a chat ID.
      java.lang.String toString()
      Returns a String that represents this instance.
      SteamID tryGetClanID()
      Converts this chat ID to a clan ID.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • UNKNOWN_ACCOUNT_TYPE_CHAR

        public static final char UNKNOWN_ACCOUNT_TYPE_CHAR
        See Also:
        Constant Field Values
      • ALL_INSTANCES

        public static final long ALL_INSTANCES
        The account instance value when representing all instanced SteamIDs.
        See Also:
        Constant Field Values
      • DESKTOP_INSTANCE

        public static final long DESKTOP_INSTANCE
        The account instance value for a desktop SteamID.
        See Also:
        Constant Field Values
      • CONSOLE_INSTANCE

        public static final long CONSOLE_INSTANCE
        The account instance value for a console SteamID.
        See Also:
        Constant Field Values
      • ACCOUNT_ID_MASK

        public static final long ACCOUNT_ID_MASK
        Masking value used for the account id.
        See Also:
        Constant Field Values
      • ACCOUNT_INSTANCE_MASK

        public static final long ACCOUNT_INSTANCE_MASK
        Masking value used for packing chat instance flags into a SteamID.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SteamID

        public SteamID()
      • SteamID

        public SteamID​(long unAccountID,
                       long unInstance,
                       EUniverse eUniverse,
                       EAccountType eAccountType)
        Initializes a new instance of the SteamID class.
        Parameters:
        unAccountID - The account ID.
        unInstance - The instance.
        eUniverse - The universe.
        eAccountType - The account type.
      • SteamID

        public SteamID​(long id)
        Initializes a new instance of the SteamID class.
        Parameters:
        id - The 64bit integer to assign this SteamID from.
      • SteamID

        public SteamID​(java.lang.String steamId)
        Initializes a new instance of the SteamID class from a Steam2 "STEAM_" rendered form. This constructor assumes the rendered SteamID is in the public universe.
        Parameters:
        steamId - A "STEAM_" rendered form of the SteamID.
      • SteamID

        public SteamID​(java.lang.String steamId,
                       EUniverse eUniverse)
        Initializes a new instance of the SteamID class from a Steam2 "STEAM_" rendered form and universe.
        Parameters:
        steamId - A "STEAM_" rendered form of the SteamID.
        eUniverse - The universe the SteamID belongs to.
    • Method Detail

      • set

        public void set​(long unAccountID,
                        EUniverse eUniverse,
                        EAccountType eAccountType)
        Sets the various components of this SteamID instance.
        Parameters:
        unAccountID - The account ID.
        eUniverse - The universe.
        eAccountType - The account type.
      • instancedSet

        public void instancedSet​(long unAccountID,
                                 long unInstance,
                                 EUniverse eUniverse,
                                 EAccountType eAccountType)
        Sets the various components of this SteamID instance.
        Parameters:
        unAccountID - The account ID.
        unInstance - The instance.
        eUniverse - The universe.
        eAccountType - The account type.
      • setFromString

        public boolean setFromString​(java.lang.String steamId,
                                     EUniverse eUniverse)
        Sets the various components of this SteamID from a Steam2 "STEAM_" rendered form and universe.
        Parameters:
        steamId - A "STEAM_" rendered form of the SteamID.
        eUniverse - The universe the SteamID belongs to.
        Returns:
        true if this instance was successfully assigned; otherwise, false if the given string was in an invalid format.
      • setFromSteam3String

        public boolean setFromSteam3String​(java.lang.String steamId)
        Sets the various components of this SteamID from a Steam3 "[X:1:2:3]" rendered form and universe.
        Parameters:
        steamId - A "[X:1:2:3]" rendered form of the SteamID.
        Returns:
        true if this instance was successfully assigned; otherwise, false if the given string was in an invalid format.
      • setFromUInt64

        public void setFromUInt64​(long longSteamId)
        Sets the various components of this SteamID from a 64bit integer form.
        Parameters:
        longSteamId - The 64bit integer to assign this SteamID from.
      • convertToUInt64

        public long convertToUInt64()
        Converts this SteamID into it's 64bit integer form.
        Returns:
        A 64bit integer representing this SteamID.
      • getStaticAccountKey

        public long getStaticAccountKey()
        Returns a static account key used for grouping accounts with differing instances.
        Returns:
        A 64bit static account key.
      • isBlankAnonAccount

        public boolean isBlankAnonAccount()
        Gets a value indicating whether this instance is a game server account.
        Returns:
        true if this instance is a blank anon account; otherwise, false.
      • isGameServerAccount

        public boolean isGameServerAccount()
        Gets a value indicating whether this instance is a game server account.
        Returns:
        true if this instance is a game server account; otherwise, false.
      • isPersistentGameServerAccount

        public boolean isPersistentGameServerAccount()
        Gets a value indicating whether this instance is a persistent game server account.
        Returns:
        true if this instance is a persistent game server account; otherwise, false.
      • isAnonGameServerAccount

        public boolean isAnonGameServerAccount()
        Gets a value indicating whether this instance is an anonymous game server account.
        Returns:
        true if this instance is an anon game server account; otherwise, false.
      • isContentServerAccount

        public boolean isContentServerAccount()
        Gets a value indicating whether this instance is a content server account.
        Returns:
        true if this instance is a content server account; otherwise, false.
      • isClanAccount

        public boolean isClanAccount()
        Gets a value indicating whether this instance is a clan account.
        Returns:
        true if this instance is a clan account; otherwise, false.
      • isChatAccount

        public boolean isChatAccount()
        Gets a value indicating whether this instance is a chat account.
        Returns:
        true if this instance is a chat account; otherwise, false.
      • isLobby

        public boolean isLobby()
        Gets a value indicating whether this instance is a lobby.
        Returns:
        true if this instance is a lobby; otherwise, false.
      • isIndividualAccount

        public boolean isIndividualAccount()
        Gets a value indicating whether this instance is an individual account.
        Returns:
        true if this instance is an individual account; otherwise, false.
      • isAnonAccount

        public boolean isAnonAccount()
        Gets a value indicating whether this instance is an anonymous account.
        Returns:
        true if this instance is an anon account; otherwise, false.
      • isAnonUserAccount

        public boolean isAnonUserAccount()
        Gets a value indicating whether this instance is an anonymous user account.
        Returns:
        true if this instance is an anon user account; otherwise, false.
      • isConsoleUserAccount

        public boolean isConsoleUserAccount()
        Gets a value indicating whether this instance is a console user account.
        Returns:
        true if this instance is a console user account; otherwise, false.
      • isValid

        public boolean isValid()
        Gets a value indicating whether this instance is valid.
        Returns:
        true if this instance is valid; otherwise, false.
      • getAccountID

        public long getAccountID()
      • setAccountID

        public void setAccountID​(long accountID)
      • getAccountInstance

        public long getAccountInstance()
      • setAccountInstance

        public void setAccountInstance​(long accountInstance)
      • setAccountType

        public void setAccountType​(EAccountType accountType)
      • getAccountUniverse

        public EUniverse getAccountUniverse()
      • setAccountUniverse

        public void setAccountUniverse​(EUniverse accountUniverse)
      • toChatID

        public SteamID toChatID()
        Converts this clan ID to a chat ID.
        Returns:
        The Chat ID for this clan's group chat.
        Throws:
        java.lang.IllegalStateException - This SteamID is not a clan ID.
      • tryGetClanID

        public SteamID tryGetClanID()
        Converts this chat ID to a clan ID. This can be used to get the group that a group chat is associated with.
        Returns:
        the group that this chat ID is associated with, null if this does not represent a group chat
      • render

        public java.lang.String render()
        Renders this instance into it's Steam3 representation.
        Returns:
        A string Steam3 representation of this SteamID.
      • render

        public java.lang.String render​(boolean steam3)
        Renders this instance into it's Steam2 "STEAM_" or Steam3 representation.
        Parameters:
        steam3 - If set to true, the Steam3 rendering will be returned; otherwise, the Steam2 STEAM_ rendering.
        Returns:
        A string Steam2 "STEAM_" representation of this SteamID, or a Steam3 representation.
      • toString

        public java.lang.String toString()
        Returns a String that represents this instance.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A String that represents this instance.
      • equals

        public boolean equals​(java.lang.Object obj)
        Determines whether the specified Object is equal to this instance.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The Object to compare with this instance.
        Returns:
        true if the specified Object is equal to this instance; otherwise, false.
      • hashCode

        public int hashCode()
        Returns a hash code for this instance.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.