Mod Setting

Mod Setting Module


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.

Mod Settings Module Example

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


Interacting with a specific players ModSetting

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

Resetting a specific players ModSetting

public void rollbackLightningModEnabledState(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));

Broadcasting a ModSettings change to an entire server.

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