Skip to Content

Mod Setting Module

Overview

The mod setting module allows you to interact with Lunar Client players mods and settings of those mods.

This module heavily integrates with our Options API. You can find all available mods and their options under the mods section.

  • Adds the ability to interact with Lunar Client mods.
    • Ability to enable/disable mods.
    • Ability to change, enable or disable mod settings within a mod.
    • Ability to retrieve the current value of any mod and settings within a mod (private feature).

Mod Settings Module Example

When mods are disabled on the server, players will receive a notification!

Integration

Mod Status API

The Mod Status API allows you to request the current value of any mod option, and to listen for updates whenever one changes.

The Mod Status API is a private feature of this module and not publicly available. The rest of the module, such as the Setting Interception API, stays public. See Mod Status for usage, and Private Modules to request access.

Setting Interception API

The Setting Interception API allows you to override the value of any mod option.

Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.

Apollo API examples. See General for common patterns and helpers.

Disable Lighting Mod

public void disableLightingModExample(Player viewer) { Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); apolloPlayerOpt.ifPresent(apolloPlayer -> this.modSettingModule.getOptions().set(apolloPlayer, ModLighting.ENABLED, false)); }

Reset Lighting Mod to it’s default value

public void rollbackLightingModEnabledState(Player viewer) { Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); // To rollback the server override value of the setting, simply set the value to "null" apolloPlayerOpt.ifPresent(apolloPlayer -> this.modSettingModule.getOptions().set(apolloPlayer, ModLighting.ENABLED, null)); }

Broadcast Disable Lighting Mod the an entire server

public void broadcastDisableLightingModExample(Player viewer) { this.modSettingModule.getOptions().set(ModLighting.ENABLED, false); }

Request Installed Mods

public void requestInstalledModsExample(Player viewer) { Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); if (!apolloPlayerOpt.isPresent()) { viewer.sendMessage("Join with Lunar Client to test this feature!"); return; } this.modSettingModule.requestInstalledMods(apolloPlayerOpt.get()) .onSuccess(response -> { List<String> modIds = response.getElements() .stream().map(LunarClientMod::getId) .collect(Collectors.toList()); viewer.sendMessage("Found " + modIds.size() + " mods: " + modIds); }) .onFailure(exception -> { viewer.sendMessage("Internal error! Check console!"); exception.printStackTrace(); }); }