RichPresencepublic class Game
extends java.lang.Object
Game.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
Game.GameType |
The type game being played, differentiating between a game and stream types.
|
| Modifier and Type | Method | Description |
|---|---|---|
RichPresence |
asRichPresence() |
RichPresence representation of
this Game. |
boolean |
equals(java.lang.Object o) |
|
java.lang.String |
getName() |
The displayed name of the
Game. |
RichPresence.Timestamps |
getTimestamps() |
Information on the match duration, start, and end.
|
Game.GameType |
getType() |
The type of
Game. |
java.lang.String |
getUrl() |
The URL of the
Game if the game is actually a Stream. |
int |
hashCode() |
|
boolean |
isRich() |
|
static boolean |
isValidStreamingUrl(java.lang.String url) |
Checks if a given String is a valid Twitch url (ie, one that will display "Streaming" on the Discord client).
|
static Game |
listening(java.lang.String name) |
Creates a new Game instance with the specified name.
|
static Game |
of(Game.GameType type,
java.lang.String name) |
Creates a new Game instance with the specified name and url.
|
static Game |
of(Game.GameType type,
java.lang.String name,
java.lang.String url) |
Creates a new Game instance with the specified name and url.
|
static Game |
playing(java.lang.String name) |
Creates a new Game instance with the specified name.
|
static Game |
streaming(java.lang.String name,
java.lang.String url) |
Creates a new Game instance with the specified name and url.
|
java.lang.String |
toString() |
|
static Game |
watching(java.lang.String name) |
Creates a new Game instance with the specified name.
|
public boolean isRich()
true if this is a RichPresencepublic RichPresence asRichPresence()
RichPresence representation of
this Game.null if isRich() returns falsepublic java.lang.String getName()
Game. If no name has been set, this returns null.public java.lang.String getUrl()
Game if the game is actually a Stream.
public Game.GameType getType()
Game.GameType representing the type of Game@Nullable public RichPresence.Timestamps getTimestamps()
Timestamps wrapper of null if unsetpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic static Game playing(java.lang.String name)
Game.streaming(String, String).name - The not-null name of the newly created gameGame.GameType.DEFAULTjava.lang.IllegalArgumentException - if the specified name is null, empty or blankpublic static Game streaming(java.lang.String name, java.lang.String url)
https://twitch.tv/ and can be verified using isValidStreamingUrl(String). (see documentation)name - The not-null name of the newly created gameurl - The streaming url to use, required to display as "streaming"java.lang.IllegalArgumentException - If the specified name is null or emptyisValidStreamingUrl(String)public static Game listening(java.lang.String name)
Listening name in the official clientname - The not-null name of the newly created gameGame.GameType.LISTENINGjava.lang.IllegalArgumentException - if the specified name is null, empty or blank@Incubating public static Game watching(java.lang.String name)
Watching name in the official clientname - The not-null name of the newly created gameGame.GameType.WATCHINGjava.lang.IllegalArgumentException - if the specified name is null, empty or blankpublic static Game of(Game.GameType type, java.lang.String name)
type - The GameType to usename - The not-null name of the newly created gamejava.lang.IllegalArgumentException - If the specified name is null or emptypublic static Game of(Game.GameType type, java.lang.String name, java.lang.String url)
GameType.STREAMING
and should be a twitch url.type - The GameType to usename - The not-null name of the newly created gameurl - The streaming url to use, required to display as "streaming".java.lang.IllegalArgumentException - If the specified name is null or emptyisValidStreamingUrl(String)public static boolean isValidStreamingUrl(java.lang.String url)
url - The url to check.