Class Activity
- All Implemented Interfaces:
AutoCloseable
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addButton
(ActivityButton button) Add a custom buttonassets()
Returns the embedded ActivityAssets structures.void
close()
Deprecated.Get the current button display modelong
Gets the application ID of the Activity.Returns the current activity custom buttonsGets what the player is currently doing.boolean
Gets whether the player is in an instancegetName()
Gets the name of the Activity.getState()
Gets the player's current party status.getType()
Gets the type of the Activity.party()
Returns the embedded ActivityParty structures.boolean
removeButton
(ActivityButton button) Remove a custom buttonsecrets()
Returns the embedded ActivitySecrets structures.void
Changes the button display modevoid
setDetails
(String details) Sets what the player is currently doing.void
setInstance
(boolean instance) Sets whether the player is in an instancevoid
Sets the player's current party status.void
setType
(ActivityType type) Sets the type of the Activity.Returns the embedded ActivityTimestamps structures.toString()
-
Constructor Details
-
Activity
public Activity()Allocates a new Activity structure.
-
-
Method Details
-
getApplicationId
public long getApplicationId()Gets the application ID of the Activity.
This is a read-only property. You are only gonna use it if you acquire the Activity from a
Presence
.- Returns:
- The application ID
-
getName
Gets the name of the Activity.
This is a read-only property. You are only gonna use it if you acquire the Activity from a
Presence
.- Returns:
- The name
-
setState
Sets the player's current party status.- Parameters:
state
- Current party status
-
getState
Gets the player's current party status.- Returns:
- Current party status or an empty string if none is set
-
setDetails
Sets what the player is currently doing.- Parameters:
details
- What the player is currently doing
-
getDetails
Gets what the player is currently doing.- Returns:
- What the player is currently doing or an empty string if it is not set
-
setType
Sets the type of the Activity.
Only for event handling. Discord will ignore this field.
- Parameters:
type
- Activity type- See Also:
-
getType
Gets the type of the Activity.
Only for event handling. Discord will ignore this field.
- Returns:
- Activity type
- See Also:
-
timestamps
Returns the embedded ActivityTimestamps structures.
The purpose of this structure is creating a "time left"-field.
- Returns:
- An ActivityTimestamps structure
-
assets
Returns the embedded ActivityAssets structures.
The purpose of this structure is attaching images to the activity.
- Returns:
- An ActivityAssets structure
-
party
Returns the embedded ActivityParty structures.
The purpose of this structure is creating a "(a of b)"-field showing how many people are in the player's party.
- Returns:
- An ActivityParty structure
-
secrets
Returns the embedded ActivitySecrets structures.
The purpose of this structure is storing secrets used in and enabling the "Ask to join"- and "Spectate"-buttons as well as the "Invite ... to play ..."- and "Invite ... to spectate ..."-options.
- Returns:
- An ActivityParty structure
-
setInstance
public void setInstance(boolean instance) Sets whether the player is in an instance- Parameters:
instance
- whether the player is in an instance
-
getInstance
public boolean getInstance()Gets whether the player is in an instance- Returns:
true
if the player is in an instance
-
close
Deprecated.No operation, only kept for backwards compatibility- Specified by:
close
in interfaceAutoCloseable
-
getButtons
Returns the current activity custom buttons
- Returns:
- An unmodifiable list of custom buttons
-
addButton
Add a custom button- Parameters:
button
- button to add
-
removeButton
Remove a custom button- Parameters:
button
- button to remove
-
setActivityButtonsMode
Changes the button display mode
Only custom buttons (ActivityButtonsMode.BUTTONS) or "Ask to join"/"Spectate" (ActivityButtonsMode.SECRETS) buttons can be displayed at the same time
- Parameters:
mode
- button mode
-
getActivityButtonsMode
Get the current button display mode
Only custom buttons (ActivityButtonsMode.BUTTONS) or "Ask to join"/"Spectate" (ActivityButtonsMode.SECRETS) buttons can be displayed at the same time
- Returns:
- current mode
-
toString
-