Package in.dragonbra.javasteam.types
Class SteamID
- java.lang.Object
-
- in.dragonbra.javasteam.types.SteamID
-
public class SteamID extends java.lang.ObjectThis 64-bit structure is used for identifying various objects on the Steam network.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSteamID.ChatInstanceFlagsRepresents various flags a chatSteamIDmay have, packed into its instance.
-
Field Summary
Fields Modifier and Type Field Description static longACCOUNT_ID_MASKMasking value used for the account id.static longACCOUNT_INSTANCE_MASKMasking value used for packing chat instance flags into aSteamID.static longALL_INSTANCESThe account instance value when representing all instancedSteamIDs.static longCONSOLE_INSTANCEThe account instance value for a consoleSteamID.static longDESKTOP_INSTANCEThe account instance value for a desktopSteamID.static charUNKNOWN_ACCOUNT_TYPE_CHARstatic longWEB_INSTANCEThe account instance for mobile or web basedSteamIDs.
-
Constructor Summary
Constructors Constructor Description SteamID()SteamID(long id)Initializes a new instance of theSteamIDclass.SteamID(long unAccountID, long unInstance, EUniverse eUniverse, EAccountType eAccountType)Initializes a new instance of theSteamIDclass.SteamID(long unAccountID, EUniverse eUniverse, EAccountType eAccountType)SteamID(java.lang.String steamId)Initializes a new instance of theSteamIDclass from a Steam2 "STEAM_" rendered form.SteamID(java.lang.String steamId, EUniverse eUniverse)Initializes a new instance of theSteamIDclass from a Steam2 "STEAM_" rendered form and universe.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longconvertToUInt64()Converts this SteamID into it's 64bit integer form.booleanequals(java.lang.Object obj)Determines whether the specifiedObjectis equal to this instance.longgetAccountID()longgetAccountInstance()EAccountTypegetAccountType()EUniversegetAccountUniverse()longgetStaticAccountKey()Returns a static account key used for grouping accounts with differing instances.inthashCode()Returns a hash code for this instance.voidinstancedSet(long unAccountID, long unInstance, EUniverse eUniverse, EAccountType eAccountType)Sets the various components of this SteamID instance.booleanisAnonAccount()Gets a value indicating whether this instance is an anonymous account.booleanisAnonGameServerAccount()Gets a value indicating whether this instance is an anonymous game server account.booleanisAnonUserAccount()Gets a value indicating whether this instance is an anonymous user account.booleanisBlankAnonAccount()Gets a value indicating whether this instance is a game server account.booleanisChatAccount()Gets a value indicating whether this instance is a chat account.booleanisClanAccount()Gets a value indicating whether this instance is a clan account.booleanisConsoleUserAccount()Gets a value indicating whether this instance is a console user account.booleanisContentServerAccount()Gets a value indicating whether this instance is a content server account.booleanisGameServerAccount()Gets a value indicating whether this instance is a game server account.booleanisIndividualAccount()Gets a value indicating whether this instance is an individual account.booleanisLobby()Gets a value indicating whether this instance is a lobby.booleanisPersistentGameServerAccount()Gets a value indicating whether this instance is a persistent game server account.booleanisValid()Gets a value indicating whether this instance is valid.java.lang.Stringrender()Renders this instance into it's Steam3 representation.java.lang.Stringrender(boolean steam3)Renders this instance into it's Steam2 "STEAM_" or Steam3 representation.voidset(long unAccountID, EUniverse eUniverse, EAccountType eAccountType)Sets the various components of this SteamID instance.voidsetAccountID(long accountID)voidsetAccountInstance(long accountInstance)voidsetAccountType(EAccountType accountType)voidsetAccountUniverse(EUniverse accountUniverse)booleansetFromSteam3String(java.lang.String steamId)Sets the various components of this SteamID from a Steam3 "[X:1:2:3]" rendered form and universe.booleansetFromString(java.lang.String steamId, EUniverse eUniverse)Sets the various components of this SteamID from a Steam2 "STEAM_" rendered form and universe.voidsetFromUInt64(long longSteamId)Sets the various components of this SteamID from a 64bit integer form.SteamIDtoChatID()Converts this clan ID to a chat ID.java.lang.StringtoString()Returns aStringthat represents this instance.SteamIDtryGetClanID()Converts this chat ID to a clan ID.
-
-
-
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 instancedSteamIDs.- See Also:
- Constant Field Values
-
DESKTOP_INSTANCE
public static final long DESKTOP_INSTANCE
The account instance value for a desktopSteamID.- See Also:
- Constant Field Values
-
CONSOLE_INSTANCE
public static final long CONSOLE_INSTANCE
The account instance value for a consoleSteamID.- See Also:
- Constant Field Values
-
WEB_INSTANCE
public static final long WEB_INSTANCE
The account instance for mobile or web basedSteamIDs.- 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 aSteamID.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SteamID
public SteamID()
-
SteamID
public SteamID(long unAccountID, EUniverse eUniverse, EAccountType eAccountType)
-
SteamID
public SteamID(long unAccountID, long unInstance, EUniverse eUniverse, EAccountType eAccountType)Initializes a new instance of theSteamIDclass.- 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 theSteamIDclass.- Parameters:
id- The 64bit integer to assign this SteamID from.
-
SteamID
public SteamID(java.lang.String steamId)
Initializes a new instance of theSteamIDclass 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.
-
-
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)
-
getAccountType
public EAccountType getAccountType()
-
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 aStringthat represents this instance.- Overrides:
toStringin classjava.lang.Object- Returns:
- A
Stringthat represents this instance.
-
equals
public boolean equals(java.lang.Object obj)
Determines whether the specifiedObjectis equal to this instance.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- TheObjectto compare with this instance.- Returns:
- true if the specified
Objectis equal to this instance; otherwise, false.
-
hashCode
public int hashCode()
Returns a hash code for this instance.- Overrides:
hashCodein classjava.lang.Object- Returns:
- A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
-
-