.dev

Modules2 min read

Module rules

Disable mods, cap settings, competitive mode, combat feel and mod policy.

modules:1Tier B · Restrict

Good for

  • Ranked arenas with an allow-list of mods
  • Capping zoom or other settings that give an edge
  • Making the 1.8 combat feel match on modern clients

Try it in game, no code

/tehoapi rules * competitive fps_display keystrokes

Module rules let your server restrict the client on your server only: turn mods off, cap or pin their settings, switch on competitive mode, set the combat feel, and ask which disallowed third-party mods a player has.

Restrictions need no consent, but they are never silent. The player's mods panel shows a "Rules from <server>" banner, and every locked mod is marked with your reason. Rules never touch the player's saved settings, and they lift when the player leaves.

Turn modules off

Java
teho.modules().disable("hitbox", "minimap");

Competitive mode

Competitive mode turns off every module except an allow-list.

Java
teho.modules().competitive("Ranked arena",
        "fps_display", "keystrokes", "cps_counter", "ping", "armor_status");

Cap or pin settings

Java
teho.modules().cap(SettingCap.atMost("zoom", "factor", 4));
teho.modules().cap(SettingCap.range("third_person_camera", "distance", 4, 8));
teho.modules().cap(SettingCap.pin("motion_blur", "intensity", 15));

The key is the setting's id inside its module, for example factor on zoom or distance on third_person_camera.

FactoryWhat it does
SettingCap.atMost(module, key, max)An upper bound.
SettingCap.range(module, key, min, max)A lower and upper bound.
SettingCap.pin(module, key, value)Forces a value. Takes a String, boolean or int.

Build the whole rule set

Each call above edits the current rules. To set everything in one go, build ModuleRules and apply it. apply replaces whatever rules the player had from you.

Java
teho.modules().apply(ModuleRules.builder()
        .disableCategory("VISUAL")
        .enable("fps_display")
        .cap(SettingCap.atMost("zoom", "factor", 4))
        .reason("Tournament rules")
        .build());
Builder methodWhat it does
disable(modules…) / enable(modules…)Adds to or removes from the disabled set.
disableCategory(categories…)HUD, COMBAT, VISUAL, QOL, CLIENT.
competitive(allowed…) / casual()Turns competitive mode on with an allow-list, or off.
cap(SettingCap) / uncap(module, key)Adds or removes a setting cap.
reason(String)Shown on every lock.

modules().rules() returns what you have applied, update(builder -> …) edits it, and clear() lifts every rule.

Combat feel

Java
teho.modules().combat(CombatRules.LEGACY_PVP);

LEGACY_PVP gives modern clients the 1.8 look: old swing animation, block-hit visuals, no hit-delay visual and the legacy red hit colour. For finer control, construct new CombatRules(legacySwing, legacyBlockHit, noHitDelayVisual, missPenaltyVisual, legacyHitColor). CombatRules.VANILLA turns it all off.

This is visual only and affects modern clients and 1.12.2; 1.7.10 and 1.8.9 already behave this way. The config switch is combat.legacy-pvp: true.

Third-party mod policy

Tell the client which mod ids you do not allow. The player sees which of their installed mods are not allowed on your server, and is asked once whether to report them to you.

Java
teho.modules().denyMods("Mod policy for ranked play", "freecam", "xaerominimap", "wurst")
        .thenAccept(report -> {
            if (report.shared() && !report.compliant()) {
                kickFromQueue(teho, report.violations());
            }
        });

PolicyReport.shared() is false when the player declined to report. violations() lists only mods on your deny list; nothing else about the player's mods is shared.

Module ids

These are the ids disable, competitive and SettingCap accept.

Text
armor_status auto_reconnect auto_text block_outline boss_bar camera chat chunk_borders clock combo_counter
coordinates cps_counter crosshair damage_tint day_counter direction_hud durability emote_wheel fog_customizer
fov_changer fps_display fps_graph friends_hud health_hud hit_color hitbox hud_layout item_tracker keybinds
keystrokes light_level lighting looking_at material_count measurement memory_usage menu_blur mod_list momentum
motion_blur nametags nick_hider notifications pack_display perspective ping playtime potion_counter
potion_effects profiles reach_display saturation_hud scoreboard screenshots server_address session_stats
shiny_pots stopwatch tab_editor target_hud third_person_camera tier_tagger time_changer titles tnt_countdown
toggle_sneak toggle_sprint totem_counter voice_overlay waypoints weather xp_hud zoom

No code

YAML
rules:
  global:
    disable: [hitbox]
    caps:
      - {module: zoom, key: factor, max: 4}
  worlds:
    arena:
      competitive: true
      allow: [fps_display, keystrokes, cps_counter, ping, armor_status]
      reason: "Ranked arena"
Text
/tehoapi rules * competitive fps_display keystrokes
/tehoapi rules Notch disable minimap
/tehoapi rules * clear