Class Activity

java.lang.Object
de.jcm.discordgamesdk.activity.Activity
All Implemented Interfaces:
AutoCloseable

public class Activity extends Object implements AutoCloseable
Java representation of the Activity structure.
See Also:
  • 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

      public String 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

      public void setState(String state)
      Sets the player's current party status.
      Parameters:
      state - Current party status
    • getState

      public String getState()
      Gets the player's current party status.
      Returns:
      Current party status or an empty string if none is set
    • setDetails

      public void setDetails(String details)
      Sets what the player is currently doing.
      Parameters:
      details - What the player is currently doing
    • getDetails

      public String 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

      public void setType(ActivityType type)

      Sets the type of the Activity.

      Only for event handling. Discord will ignore this field.

      Parameters:
      type - Activity type
      See Also:
    • getType

      public ActivityType getType()

      Gets the type of the Activity.

      Only for event handling. Discord will ignore this field.

      Returns:
      Activity type
      See Also:
    • timestamps

      public ActivityTimestamps timestamps()

      Returns the embedded ActivityTimestamps structures.

      The purpose of this structure is creating a "time left"-field.

      Returns:
      An ActivityTimestamps structure
    • assets

      public ActivityAssets assets()

      Returns the embedded ActivityAssets structures.

      The purpose of this structure is attaching images to the activity.

      Returns:
      An ActivityAssets structure
    • party

      public ActivityParty 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

      public ActivitySecrets 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 public void close()
      Deprecated.
      No operation, only kept for backwards compatibility
      Specified by:
      close in interface AutoCloseable
    • getButtons

      public List<ActivityButton> getButtons()

      Returns the current activity custom buttons

      Returns:
      An unmodifiable list of custom buttons
    • addButton

      public void addButton(ActivityButton button)
      Add a custom button
      Parameters:
      button - button to add
    • removeButton

      public boolean removeButton(ActivityButton button)
      Remove a custom button
      Parameters:
      button - button to remove
    • setActivityButtonsMode

      public void setActivityButtonsMode(ActivityButtonsMode mode)

      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

      public ActivityButtonsMode 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

      public String toString()
      Overrides:
      toString in class Object