Class ConfigValueImpl<T>
java.lang.Object
net.ixdarklord.coolcatcore.internal.config.ConfigNodeImpl
net.ixdarklord.coolcatcore.internal.config.ConfigValueImpl<T>
- All Implemented Interfaces:
Supplier<T>,ConfigNode,ConfigValue<T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.ixdarklord.coolcatcore.api.config.ConfigValue
ConfigValue.ChangeListener<T> -
Constructor Summary
ConstructorsConstructorDescriptionConfigValueImpl(String key, ConfigGroupImpl parent, List<String> comment, @Nullable String translationKey, boolean hidden, ConfigType<T> type, T defaultValue, RestartRequirement restart, boolean synced, StartupSync startupSync, List<String> aliases, List<Function<T, net.minecraft.network.chat.Component>> validators, @Nullable ConfigDependency<?> dependency) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(ConfigValue.ChangeListener<T> listener) Called on the thread that changed the value, after it changed.aliases()The old keys (or dotted paths from the root) this value is still read from, for renamed or moved settings.decode(com.google.gson.JsonElement json) The value this one depends on, if it was built withenabledWhen.com.google.gson.JsonElementcom.google.gson.JsonElementcom.google.gson.JsonElementencodeUnchecked(Object value) get()The current value.The value in the file.booleanisSynced()Whether a synced config sends this value to clients.booleanremoveListener(ConfigValue.ChangeListener<T> listener) booleanvoidChanges the value in memory and notifies listeners;Config.save()writes it.How a syncedConfigScope.STARTUPvalue is reconciled with the server's; ignored by other scopes.toString()type()Checks a value against the type and the entry's own validators, without setting it.validateUnchecked(Object value) Validates a value of unknown type, as the config screen and network hand them over.Methods inherited from class net.ixdarklord.coolcatcore.internal.config.ConfigNodeImpl
comment, config, configOrNull, displayName, isHidden, key, parent, path, prettify, translationKeyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.ixdarklord.coolcatcore.api.config.ConfigNode
comment, config, displayName, isHidden, key, parent, path, translationKeyMethods inherited from interface net.ixdarklord.coolcatcore.api.config.ConfigValue
isActive, isDefault, isRestartPending, reset
-
Constructor Details
-
ConfigValueImpl
public ConfigValueImpl(String key, ConfigGroupImpl parent, List<String> comment, @Nullable @Nullable String translationKey, boolean hidden, ConfigType<T> type, T defaultValue, RestartRequirement restart, boolean synced, StartupSync startupSync, List<String> aliases, List<Function<T, net.minecraft.network.chat.Component>> validators, @Nullable @Nullable ConfigDependency<?> dependency)
-
-
Method Details
-
get
Description copied from interface:ConfigValueThe current value. -
getStored
Description copied from interface:ConfigValueThe value in the file. It equalsConfigValue.get()except for aConfigScope.STARTUPvalue changed since the game started:get()keeps the value the game started with, and this one applies after a restart.- Specified by:
getStoredin interfaceConfigValue<T>
-
set
Description copied from interface:ConfigValueChanges the value in memory and notifies listeners;Config.save()writes it. A value the type corrects (a number out of range, say) is stored corrected. AConfigScope.STARTUPvalue only changes its stored value, for the next start.- Specified by:
setin interfaceConfigValue<T>
-
validate
Description copied from interface:ConfigValueChecks a value against the type and the entry's own validators, without setting it.- Specified by:
validatein interfaceConfigValue<T>
-
validateUnchecked
Validates a value of unknown type, as the config screen and network hand them over. -
decode
-
encode
-
encodeCurrent
public com.google.gson.JsonElement encodeCurrent() -
encodeUnchecked
-
sameValue
-
getDefault
- Specified by:
getDefaultin interfaceConfigValue<T>
-
type
- Specified by:
typein interfaceConfigValue<T>
-
restartRequirement
- Specified by:
restartRequirementin interfaceConfigValue<T>
-
isSynced
public boolean isSynced()Description copied from interface:ConfigValueWhether a synced config sends this value to clients. Off for server secrets (a webhook URL, a password), which stay on the server and can't be edited from a client.- Specified by:
isSyncedin interfaceConfigValue<T>
-
startupSync
Description copied from interface:ConfigValueHow a syncedConfigScope.STARTUPvalue is reconciled with the server's; ignored by other scopes.- Specified by:
startupSyncin interfaceConfigValue<T>
-
aliases
Description copied from interface:ConfigValueThe old keys (or dotted paths from the root) this value is still read from, for renamed or moved settings.- Specified by:
aliasesin interfaceConfigValue<T>
-
dependency
Description copied from interface:ConfigValueThe value this one depends on, if it was built withenabledWhen.- Specified by:
dependencyin interfaceConfigValue<T>
-
addListener
Description copied from interface:ConfigValueCalled on the thread that changed the value, after it changed.- Specified by:
addListenerin interfaceConfigValue<T>
-
removeListener
- Specified by:
removeListenerin interfaceConfigValue<T>
-
toString
-