Apollo
Developers
Modules
Server Rule

Server Rule Module

Overview

The server rule module contains pre-created settings servers can enable or disable, comparable to Minecraft's /gamerule command.

This module heavily integrates with our Options API.

  • Toggle or set values for pre-created server settings.
    • Ability to enable the competitive game popup.
    • Ability to forcefully disable Lunar Client mod settings and shaders.
    • Ability to override the max chat length and nametag render distance.
    • Ability to enable the quality of life features, anti-portal-trap and disable broadcasting.

Integration

Sample Code

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

Toggle Anti Portal Traps

public void setAntiPortalTraps(boolean value) {
    this.serverRuleModule.getOptions().set(ServerRuleModule.ANTI_PORTAL_TRAPS, value);
}

Override Nametag Render Distance

public void setOverrideNametagRenderDistance(Player viewer, boolean value) {
    Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
 
    apolloPlayerOpt.ifPresent(apolloPlayer -> {
        this.serverRuleModule.getOptions().set(apolloPlayer, ServerRuleModule.OVERRIDE_NAMETAG_RENDER_DISTANCE, value);
    });
}

Broadcast Nametag Render Distance

public void setNametagRenderDistanceExample(int value) {
    this.serverRuleModule.getOptions().set(ServerRuleModule.NAMETAG_RENDER_DISTANCE, value);
}

Available options

  • COMPETITIVE_GAME

    • Whether the player should see a popup prior to disconnecting.
    • Values
      • Type: Boolean
      • Default: false
  • COMPETITIVE_COMMANDS

    • A list of commands that will trigger the competitive popup.
    • Values
      • Type: List<String>
      • Default: ["/server", "/servers", "/hub"]
  • DISABLE_SHADERS

    • Prevents users from enabling shaders.
    • Values
      • Type: Boolean
      • Default: false
  • DISABLE_CHUNK_RELOADING

    • Disables chunk reloading (F3 + A) and disables shaders reload while using Iris (R).
    • Values
      • Type: Boolean
      • Default: false
  • DISABLE_BROADCASTING

    • Disables the broadcast to twitch menu added in 1.7 & 1.8 (F6).
    • Values
      • Type: Boolean
      • Default: false
  • ANTI_PORTAL_TRAPS

    • Allows players to open their chat while in a nether portal.
    • Values
      • Type: Boolean
      • Default: false
⚠️

You'll need to disable the lighting mod in Lunar Client to control the players brightness levels.

  • OVERRIDE_BRIGHTNESS

    • Whether to use brightness value set in the BRIGHTNESS option.
    • Values
      • Type: Boolean
      • Default: false
  • BRIGHTNESS

    • The override brightness value.
    • Values
      • Type: Integer
      • Default: 50
      • Minimum: 1
      • Maximum: 10000
  • OVERRIDE_NAMETAG_RENDER_DISTANCE

    • Whether to use nametag render distance value set in the NAMETAG_RENDER_DISTANCE option.
    • Values
      • Type: Boolean
      • Default: false
  • NAMETAG_RENDER_DISTANCE

    • The override nametag render distance value.
    • Values
      • Type: Integer
      • Default: 64
      • Minimum: 1
      • Maximum: 96
  • OVERRIDE_MAX_CHAT_LENGTH

    • Whether to use max chat value set in the MAX_CHAT_LENGTH option.
    • Values
      • Type: Boolean
      • Default: false
  • MAX_CHAT_LENGTH

    • The override max chat length value.
    • Values
      • Type: Integer
      • Default: 256
      • Minimum: 1
      • Maximum: 256