Package me.hackware.api.setting
Class SettingGroup
java.lang.Object
me.hackware.api.setting.Setting<Boolean>
me.hackware.api.setting.impl.BooleanSetting
me.hackware.api.setting.SettingGroup
A group of settings that extends
BooleanSetting.
When toggleable, left-click toggles the enabled state; when non-toggleable, it acts purely as a folder. Right-click always expands / collapses the children.
Usage:
SettingGroup targets = addSetting(new SettingGroup("Targets")
.add(new BooleanSetting("Players").defaultValue(true))
.add(new BooleanSetting("Mobs").defaultValue(false)));
SettingGroup shield = addSetting(new SettingGroup("Shield Break")
.toggleable()
.defaultValue(true)
.add(new NumberSetting<Double>("Delay").defaultValue(0.5).min(0.0).max(2.0)));
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a child setting to this group (fluent, returns the group).<S extends Setting<?>>
SaddSettings(S child) Adds a child setting and returns the child (for storing a reference).defaultValue(Boolean defaultValue) description(String description) displayName(String displayName) booleanTrue if at least one direct child setting is currently visible.booleanvoidsetOwner(SettingContainer owner) When the group is assigned to a container, propagate ownership to all children so that childsetValue()calls trigger config saves.Makes this group toggleable (left-click enables / disables).toggleable(boolean toggleable) visible(boolean visible) visible(BooleanSupplier visible) Methods inherited from class me.hackware.api.setting.impl.BooleanSetting
onChanged, toggleMethods inherited from class me.hackware.api.setting.Setting
get, getDefaultValue, getDescription, getDisplayName, getGroup, getName, getOwner, isBulkLoading, isVisible, setBulkLoadProbe, setValue
-
Constructor Details
-
SettingGroup
-
SettingGroup
-
-
Method Details
-
toggleable
Makes this group toggleable (left-click enables / disables). -
toggleable
-
add
Adds a child setting to this group (fluent, returns the group). -
addSettings
Adds a child setting and returns the child (for storing a reference). -
displayName
- Overrides:
displayNamein classBooleanSetting
-
defaultValue
- Overrides:
defaultValuein classBooleanSetting
-
description
- Overrides:
descriptionin classBooleanSetting
-
group
- Overrides:
groupin classBooleanSetting
-
visible
- Overrides:
visiblein classBooleanSetting
-
visible
- Overrides:
visiblein classBooleanSetting
-
setOwner
When the group is assigned to a container, propagate ownership to all children so that childsetValue()calls trigger config saves. -
isToggleable
public boolean isToggleable() -
getChildren
-
hasVisibleChildren
public boolean hasVisibleChildren()True if at least one direct child setting is currently visible.
-