Apollo
Developers
Modules
Rich Presence

Rich Presence Module

Overview

The rich presence module allows you to interact with Discord and Lunar Client's launcher rich presence.

  • Display various information about gamemodes and your server on player's rich presence.
    • Ability to display different gamemode related attributes;
      • Gamemode Name
      • Gamemode Variant
      • Current Game State
      • Current Player State
      • Map Name
      • Team Size Attributes

Your server must be a part of Lunar Client's ServerMappings to use this module.

Integration

Sample Code

public void overrideServerRichPresenceExample(Player viewer) {
    Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
 
    apolloPlayerOpt.ifPresent(apolloPlayer -> {
        this.richPresenceModule.overrideServerRichPresence(apolloPlayer, ServerRichPresence.builder()
            .gameName("BedWars")
            .gameVariantName("Solo")
            .gameState("In Game")
            .playerState("Playing")
            .mapName("Winter")
            .subServerName("BW02")
            .teamCurrentSize(3)
            .teamMaxSize(4)
            .build()
        );
    });
}

ServerRichPresence Options

.gameName(String) the name of the game the player is playing on.

.gameName("BedWars")

.gameVariantName(String) the variant of the game the player is playing on.

.gameVariantName("Solo")

.gameState(String) the state of the current game.

.gameState("In Game")

.playerState(String) what the player is currently doing in the game.

.playerState("Playing")

.mapName(String) the name of the map the player is playing on.

.mapName("Winter")

.subServerName(String) the sub server name of the server the player is playing on.

.subServerName("BW02")

.teamCurrentSize(Integer) the current size of the player's team.

.teamCurrentSize(3)

.teamMaxSize(Integer) the max size of the player's team.

.teamMaxSize(4)

Resetting the server rich presence for a player

public void resetServerRichPresenceExample(Player viewer) {
    Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
    apolloPlayerOpt.ifPresent(this.richPresenceModule::resetServerRichPresence);
}