Skip to content

Conversation

@ItsNature
Copy link
Collaborator

@ItsNature ItsNature commented Mar 29, 2024

Overview

Description:
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

Further documentation can temporarily be found here.

Changes:
Added ServerRichPresence class builder

  • String gameName
  • String gameVariantName
  • String gameState
  • String playerState
  • String mapName
  • String subServerName
  • int teamCurrentSize
  • int teamMaxSize

Added RichPresenceModule#overrideServerRichPresence(Recipients, ServerRichPresence) API method
Added RichPresenceModule#resetServerRichPresence(Recipients) API method

Added OverrideServerRichPresenceMessage protobuf message
Added ResetServerRichPresenceMessage protobuf message

Code Example:

Override the server rich presence for a player

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()
        );
    });
}

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);
}

Review Request Checklist

  • Your code follows the style guidelines of this project.
  • I have performed a self-review of my code.
  • I have tested this change myself. (If applicable)
  • I have made corresponding changes to the documentation. (If applicable)
  • The branch name follows the projects naming conventions. (e.g. feature/add-module & bugfix/fix-issue)

@ItsNature ItsNature added the type: Enhancement Feature improvement or addition label Mar 29, 2024
@ItsNature ItsNature marked this pull request as ready for review April 4, 2024 17:26
@ItsNature ItsNature merged commit 89a0732 into version/1.1.2 Apr 5, 2024
@ItsNature ItsNature deleted the feature/rich-status-module branch April 5, 2024 12:17
@ItsNature ItsNature mentioned this pull request Apr 5, 2024
TrentinTheKid added a commit that referenced this pull request Apr 6, 2024
* Deploy as 1.1.2-SNAPSHOT

* improve notification example to test newlines (#138)

* Feature - Support SVG icons for cooldowns (#139)

* add svg example for cooldowns

* add documentation for svg cooldown icons

* Update cooldown example

* Update cooldown docs

* Minor cooldown example change

---------

Co-authored-by: TrentinTheKid <25537885+TrentinTheKid@users.noreply.github.com>
Co-authored-by: ItsNature <matej.bucaric@gmail.com>

* Feature - Rich Presence Module (#141)

* Implement Rich Status module

* Implement rich status resetting

* Make most rich status fields nullable

* Rename to rich presence

* Add overview desc to rich presence module

---------

Co-authored-by: TrentinTheKid <25537885+TrentinTheKid@users.noreply.github.com>

* Bump to 1.1.2 (#142)

* Sync LunarClient Mods & Options (#143)

* Sync LunarClient Mods & Options

* Update version tags to 1.1.2

---------

Co-authored-by: LunarClient Bot <lc-bot@moonsworth.com>

---------

Co-authored-by: Connor <vectrixu+gh@gmail.com>
Co-authored-by: TrentinTheKid <25537885+TrentinTheKid@users.noreply.github.com>
Co-authored-by: LunarClient Bot <lc-bot@moonsworth.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: Enhancement Feature improvement or addition

Development

Successfully merging this pull request may close these issues.

6 participants