Settings
Settings.java
@name("Settings")
@author("Author")
@description("Settings")
StitchBooleanSetting booleanSetting;
StitchNumberSetting numberSetting;
StitchNumberRangeSetting numberRangeSetting;
StitchColorSetting colorSetting;
StitchEnumSetting<EnumSetting> enumSetting;
StitchStringSetting stringSetting;
@Override
public void initialize() {
this.booleanSetting = getSettings().registerBoolean("Boolean Setting!", true);
this.numberSetting = getSettings().registerNumber("Number Setting!", 0, 10, 5.5, 0.5);
this.numberRangeSetting = getSettings().registerNumberRange("Number Range Setting!", 0, 10, 3.5, 6.5, 0.5);
this.colorSetting = getSettings().registerColor("Color Setting!", Color.WHITE);
this.enumSetting = getSettings().registerEnum("Enum Setting!", EnumSetting.MODE_1);
this.stringSetting = getSettings().registerString("String Setting!", "String Value");
// settings can be hidden by using a Supplier<Boolean>
// '() -> value' if the value is true the setting will be visible, otherwise it will be hidden
// getSettings().registerString("String Setting!", "String Value", () -> value);
// getting the values
this.booleanSetting.getValue();
this.numberSetting.getValue().doubleValue();
this.numberRangeSetting.getValue().a();
this.numberRangeSetting.getValue().b();
this.colorSetting.getValue();
this.enumSetting.getValue();
this.stringSetting.getValue();
}
enum EnumSetting {
MODE_1("Mode 1"),
MODE_2("Mode 2"),
MODE_3("Mode 3");
private final String label;
EnumSetting(String label) {
this.label = label;
}
@Override
public String toString() {
return this.label;
}
}
Last updated