Reference

HudModuleSetting

The base of the six setting types a module hands to its context menu and its settings page. Each is a plain class with public final fields, built through its constructor.

public abstract class HudModuleSetting, in com.eymistaken.simplecps.api, with one field: public final String label, the text on the row. All six types arrived with the API in 1.1.0.

BooleanSetting

BooleanSetting(String label, Supplier<Boolean> getter, Consumer<Boolean> setter)since 1.1.0

An [ON] or [OFF] toggle. getter is read when the row is drawn, and setter is called with the new value on each click.

ColorSetting

ColorSetting(String label, Supplier<Integer> getter, Consumer<Integer> setter)since 1.1.0

A color swatch that opens the color picker. setter receives the picked color.

TextSetting

TextSetting(String label, Supplier<String> getter, Consumer<String> setter)since 1.1.0

Shows the current value and opens an inline text field on click. Enter hands the text to setter; Esc cancels.

CycleSetting

CycleSetting(String label, List<String> options, Supplier<Integer> getter, Consumer<Integer> setter)since 1.1.0

Steps through options on each click. getter and setter work with the index into the list, not the string.

ActionSetting

ActionSetting(String label, Runnable action)since 1.1.0

A plain button with no value. action runs on click.

ActionSetting(String label, int color, Runnable action)since 1.2.5

The same, with the label tinted an ARGB color in the editor's context menu, to mark a row that opens something rather than changing a value. 0 keeps the default, which is what the two-argument constructor passes.

SliderSetting

SliderSetting(String label, int min, int max, int defaultValue, Supplier<Integer> getter, Consumer<Integer> setter)since 1.1.0

A draggable integer slider from min to max, with a live value and a Reset button. defaultValue is where Reset puts it, and the only default the settings page's per-row reset arrow can use.