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

public abstract class AbstractSetting<T> extends Object
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 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

      public String getTranslationKey()
      Returns:
      The translation key of the name.
    • mapTranslationKey

      public static String mapTranslationKey(String input)
      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

      public T getDefaultValue()
    • getValue

      public T getValue()
    • getCurrentValue

      public T getCurrentValue()
    • setValue

      public void setValue(T value)
    • getTooltip

      public net.minecraft.network.chat.Component getTooltip()
    • setTooltip

      public void setTooltip(net.minecraft.network.chat.Component tooltip)
    • setTooltip

      public void setTooltip(Supplier<net.minecraft.network.chat.Component> tooltip)
    • lockValue

      public void lockValue()
      Locks the setting so any change to the first value loaded will only be applied after restarting the game.