Class PlayerSetting<T>
java.lang.Object
fr.robie.machineengine.api.player.PlayerSetting<T>
- All Implemented Interfaces:
net.kyori.adventure.key.Keyed
A per-player value players change themselves (D37), with
/machinesettings or the zMenu
settings menu. Registered with RegistrationContext#playerSettings(); read with
MachinePlayer.get(PlayerSetting), which applies the server owner's default and lock
(players.setting-defaults, players.locked-settings in MachineEngine's config.yml).
The value is saved as text, so a setting's default may change between versions without a migration.
Players see the name and description translated on their client (D23): the lang keys
setting.<namespace>.<id> and setting.<namespace>.<id>.description of the addon's
CraftEngine pack.
public static final PlayerSetting<Boolean> HUD = PlayerSetting.bool(Key.key("mymod", "hud"), true);
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull PlayerSetting<Boolean> bool(@NotNull net.kyori.adventure.key.Key key, boolean defaultValue) On or off; a click in the menu toggles it.static <E extends Enum<E>>
@NotNull PlayerSetting<E> choice(@NotNull net.kyori.adventure.key.Key key, E defaultValue) One of the constants of an enum, written in lower case with dashes; a click cycles through them.@NotNull PlayerDataKey<T> data()Where the value is kept: a persistent key of the same id, registered with the setting.static @NotNull PlayerSetting<Double> decimal(@NotNull net.kyori.adventure.key.Key key, double defaultValue, double min, double max, double step) A number frommintomax; a click adds or removesstep.@NotNull StringLang key of the setting's one-line description.@NotNull Stringexpected()What a valid value looks like: "true or false".@NotNull StringThe value as players type it.@NotNull net.kyori.adventure.key.Keykey()@NotNull StringnameKey()Lang key of the setting's name.The valuetextstands for ("on","12","fast-mode"), ornullif it is not valid.The value after one click in the menu: toggled, the next (or previous) choice, or one step more (or less).Values offered when the player types the command.toString()static @NotNull PlayerSetting<Long> whole(@NotNull net.kyori.adventure.key.Key key, long defaultValue, long min, long max, long step) A whole number frommintomax; a click adds or removesstep.
-
Method Details
-
bool
@NotNull public static @NotNull PlayerSetting<Boolean> bool(@NotNull @NotNull net.kyori.adventure.key.Key key, boolean defaultValue) On or off; a click in the menu toggles it. -
choice
@NotNull public static <E extends Enum<E>> @NotNull PlayerSetting<E> choice(@NotNull @NotNull net.kyori.adventure.key.Key key, @NotNull E defaultValue) One of the constants of an enum, written in lower case with dashes; a click cycles through them. -
whole
@NotNull public static @NotNull PlayerSetting<Long> whole(@NotNull @NotNull net.kyori.adventure.key.Key key, long defaultValue, long min, long max, long step) A whole number frommintomax; a click adds or removesstep. -
decimal
@NotNull public static @NotNull PlayerSetting<Double> decimal(@NotNull @NotNull net.kyori.adventure.key.Key key, double defaultValue, double min, double max, double step) A number frommintomax; a click adds or removesstep. -
key
@NotNull public @NotNull net.kyori.adventure.key.Key key()- Specified by:
keyin interfacenet.kyori.adventure.key.Keyed
-
defaultValue
-
data
Where the value is kept: a persistent key of the same id, registered with the setting. -
parse
-
format
-
step
-
suggestions
-
expected
What a valid value looks like: "true or false". -
nameKey
Lang key of the setting's name. -
descriptionKey
Lang key of the setting's one-line description. -
toString
-