import { Tab, Tabs } from 'nextra-theme-docs' import { Callout } from 'nextra-theme-docs'
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.
Explore each integration by cycling through each tab, to find the best fit for your requirements and needs.
<Tabs items={['Apollo API', 'apollo-protos library', 'Manual JSON Object Construction']}>
public void setAntiPortalTraps(boolean value) {
this.serverRuleModule.getOptions().set(ServerRuleModule.ANTI_PORTAL_TRAPS, value);
}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);
});
}public void setNametagRenderDistanceExample(int value) {
this.serverRuleModule.getOptions().set(ServerRuleModule.NAMETAG_RENDER_DISTANCE, value);
}Toggle Anti Portal Traps
public void setAntiPortalTraps(boolean value) {
Map<String, Value> properties = new HashMap<>();
properties.put("anti-portal-traps", Value.newBuilder().setBoolValue(value).build());
ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("server_rule", properties);
ProtobufPacketUtil.broadcastPacket(settings);
}Override Nametag Render Distance
public void setOverrideNametagRenderDistance(Player viewer, boolean value) {
Map<String, Value> properties = new HashMap<>();
properties.put("override-nametag-render-distance", Value.newBuilder().setBoolValue(value).build());
ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("server_rule", properties);
ProtobufPacketUtil.sendPacket(viewer, settings);
}Broadcast Nametag Render Distance
public void setNametagRenderDistanceExample(int value) {
Map<String, Value> properties = new HashMap<>();
properties.put("nametag-render-distance", Value.newBuilder().setNumberValue(value).build());
ConfigurableSettings settings = ProtobufPacketUtil.createModuleMessage("server_rule", properties);
ProtobufPacketUtil.broadcastPacket(settings);
}Toggle Anti Portal Traps
public void setAntiPortalTraps(boolean value) {
Map<String, Object> properties = new HashMap<>();
properties.put("anti-portal-traps", value);
JsonObject message = JsonUtil.createEnableModuleObjectWithType("server_rule", properties);
JsonPacketUtil.broadcastPacket(message);
}Override Nametag Render Distance
public void setOverrideNametagRenderDistance(Player viewer, boolean value) {
Map<String, Object> properties = new HashMap<>();
properties.put("override-nametag-render-distance", value);
JsonObject message = JsonUtil.createEnableModuleObjectWithType("server_rule", properties);
JsonPacketUtil.sendPacket(viewer, message);
}Broadcast Nametag Render Distance
public void setNametagRenderDistanceExample(int value) {
Map<String, Object> properties = new HashMap<>();
properties.put("nametag-render-distance", value);
JsonObject message = JsonUtil.createEnableModuleObjectWithType("server_rule", properties);
JsonPacketUtil.broadcastPacket(message);
}-
COMPETITIVE_GAME- Whether the player should see a popup prior to disconnecting.
- Values
- Type:
Boolean - Default:
false
- Type:
-
COMPETITIVE_COMMANDS- A list of commands that will trigger the competitive popup.
- Values
- Type:
List<String> - Default:
["/server", "/servers", "/hub"]
- Type:
-
DISABLE_SHADERS- Prevents users from enabling shaders.
- Values
- Type:
Boolean - Default:
false
- Type:
-
DISABLE_CHUNK_RELOADING- Disables chunk reloading (F3 + A) and disables shaders reload while using Iris (R).
- Values
- Type:
Boolean - Default:
false
- Type:
-
DISABLE_BROADCASTING- Disables the broadcast to twitch menu added in 1.7 & 1.8 (F6).
- Values
- Type:
Boolean - Default:
false
- Type:
-
ANTI_PORTAL_TRAPS- Allows players to open their chat while in a nether portal.
- Values
- Type:
Boolean - Default:
false
- Type:
-
OVERRIDE_BRIGHTNESS- Whether to use brightness value set in the
BRIGHTNESSoption. - Values
- Type:
Boolean - Default:
false
- Type:
- Whether to use brightness value set in the
-
BRIGHTNESS- The override brightness value.
- Values
- Type:
Integer - Default:
50 - Minimum:
1 - Maximum:
10000
- Type:
-
OVERRIDE_NAMETAG_RENDER_DISTANCE- Whether to use nametag render distance value set in the
NAMETAG_RENDER_DISTANCEoption. - Values
- Type:
Boolean - Default:
false
- Type:
- Whether to use nametag render distance value set in the
-
NAMETAG_RENDER_DISTANCE- The override nametag render distance value.
- Values
- Type:
Integer - Default:
64 - Minimum:
1 - Maximum:
96
- Type:
-
OVERRIDE_MAX_CHAT_LENGTH- Whether to use max chat value set in the
MAX_CHAT_LENGTHoption. - Values
- Type:
Boolean - Default:
false
- Type:
- Whether to use max chat value set in the
-
MAX_CHAT_LENGTH- The override max chat length value.
- Values
- Type:
Integer - Default:
256 - Minimum:
1 - Maximum:
256
- Type:
-
CRYSTAL_OPTIMIZER- Whether to enable crystal optimizer.
- Values
- Type:
Boolean - Default:
false
- Type: