Class AbstractEntryBuilder<T,B extends AbstractEntryBuilder<T,B>>
java.lang.Object
net.ixdarklord.coolcatcore.api.config.AbstractEntryBuilder<T,B>
- Type Parameters:
T- the value's typeB- the builder's own type, for chaining
- Direct Known Subclasses:
EntryBuilder,ListEntryBuilder,NumberEntryBuilder,StringEntryBuilder
The options every entry has. Finish with
build(), which adds the value to the group that was current
when the entry was started.-
Method Summary
Modifier and TypeMethodDescriptionKeys this value had before: a bare key is looked up in the same group, a dotted path from the root.build()Adds the value to the config.Lines written above the value in the file; also its tooltip when there's no.tooltiptranslation.enabledWhen(ConfigValue<Boolean> other) Greys the value out in the config screen whileotheris off.<V> BenabledWhen(ConfigValue<V> other, Predicate<? super V> condition) Greys the value out in the config screen whileother's value doesn't meet the condition.hidden()Keeps the value out of the config screen; it's still in the file and commands.listener(ConfigValue.ChangeListener<T> listener) Called whenever the value changes; seeConfigValue.addListener(net.ixdarklord.coolcatcore.api.config.ConfigValue.ChangeListener<T>).In aConfigScope.STARTUPconfig, lets each side keep its own value: it isn't compared with the server's.Changes take effect after restarting the game.requiresRestart(RestartRequirement restart) Changes take effect after rejoining the world.protected final Bself()In a synced config, keeps the value on the server: it isn't sent to players, who can't see or change it (only the host of a singleplayer world can).translation(String translationKey) A translation key for the name, instead ofconfig.<modid>.<config>.<path>.protected abstract ConfigType<T>type()The type the entry is built with, once every option is set.In aConfigScope.STARTUPconfig, lets a client whose value differs join, and uses the server's value while connected; seeStartupSync.USE_SERVER.An extra check returning an error message, or null for a valid value.An extra check beyond the type's constraints.
-
Method Details
-
type
The type the entry is built with, once every option is set. -
comment
Lines written above the value in the file; also its tooltip when there's no.tooltiptranslation. -
translation
A translation key for the name, instead ofconfig.<modid>.<config>.<path>. -
requiresRestart
-
requiresGameRestart
Changes take effect after restarting the game. -
requiresWorldRestart
Changes take effect after rejoining the world. -
serverOnly
In a synced config, keeps the value on the server: it isn't sent to players, who can't see or change it (only the host of a singleplayer world can). For secrets like tokens and passwords. -
localOnly
In aConfigScope.STARTUPconfig, lets each side keep its own value: it isn't compared with the server's. For client-side details, like a texture variant. (The same asserverOnly().) -
useServerValue
In aConfigScope.STARTUPconfig, lets a client whose value differs join, and uses the server's value while connected; seeStartupSync.USE_SERVER. By default the values must match. -
aliases
Keys this value had before: a bare key is looked up in the same group, a dotted path from the root. The file is rewritten with the current key. -
validator
An extra check beyond the type's constraints. -
validator
An extra check returning an error message, or null for a valid value. -
enabledWhen
Greys the value out in the config screen whileotheris off. -
enabledWhen
Greys the value out in the config screen whileother's value doesn't meet the condition. -
listener
Called whenever the value changes; seeConfigValue.addListener(net.ixdarklord.coolcatcore.api.config.ConfigValue.ChangeListener<T>). -
build
Adds the value to the config.- Throws:
IllegalArgumentException- when the default value isn't valid, or the key is takenIllegalStateException- when the entry or the config was already built
-
self
-