Class AbstractSetting<T>
java.lang.Object
com.viaversion.viafabricplus.api.settings.AbstractSetting<T>
- Type Parameters:
T- The type of the setting.
- Direct Known Subclasses:
BooleanSetting,ButtonSetting,ModeSetting,VersionedBooleanSetting
This class is the base for all settings. It contains the name, the default value and the current value.
Developer's should always use the implementations of this class, and not this class itself.
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractSetting(SettingGroup parent, net.minecraft.network.chat.MutableComponent name, T defaultValue) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.network.chat.MutableComponentgetName()net.minecraft.network.chat.ComponentgetValue()voidLocks the setting so any change to the first value loaded will only be applied after restarting the game.static StringmapTranslationKey(String input) Cuts the name of a translation from its key / path.voidabstract voidread(com.google.gson.JsonObject object) voidsetTooltip(Supplier<net.minecraft.network.chat.Component> tooltip) voidsetTooltip(net.minecraft.network.chat.Component tooltip) voidabstract voidwrite(com.google.gson.JsonObject object)
-
Constructor Details
-
AbstractSetting
public AbstractSetting(SettingGroup parent, net.minecraft.network.chat.MutableComponent name, T defaultValue)
-
-
Method Details
-
write
public abstract void write(com.google.gson.JsonObject object) -
read
public abstract void read(com.google.gson.JsonObject object) -
onValueChanged
public void onValueChanged() -
getName
public net.minecraft.network.chat.MutableComponent getName() -
getTranslationKey
- Returns:
- The translation key of the name.
-
mapTranslationKey
Cuts the name of a translation from its key / path.- Parameters:
input- The translation key.- Returns:
- The name of the translation. (E. g: "viafabricplus.settings.base" -> "base")
-
getDefaultValue
-
getValue
-
getCurrentValue
-
setValue
-
getTooltip
public net.minecraft.network.chat.Component getTooltip() -
setTooltip
public void setTooltip(net.minecraft.network.chat.Component tooltip) -
setTooltip
-
lockValue
public void lockValue()Locks the setting so any change to the first value loaded will only be applied after restarting the game.
-