Settings
Making your bot configurable.
The DefaultUI will automatically generate JavaFX controls and add them to the UI on your behalf, all you have to do is create an interface telling RuneMate about the settings. These settings are stored in the bot StoredProperties automatically, and retrieved from the previous session.
When the bot starts, RuneMate will scan the bot main class for any fields annotated @SettingsProvider and inject a reference to an instance of that class, for example:
The Settings Descriptor
Settings are declared using an interface that extends Settings, which must use the following format:
Must be an interface
Must be annotating with @SettingsGroup
Each individual settings is:
Described using a default method where the return value is the default value
Annotated with @Setting which contains the setting metadata
Here is a basic example:
@SettingsGroup
This class-level annotation tells RuneMate that this class describes settings. I has an optional parameter group
will be useful in future, but it's only purpose currently is to provide version control.
@Setting
This annotation is used to declare various characteristics about the setting:
Special Annotations
There are various "special" annotations which are data-type specific.
@Range - for int settings, described the maximum, minimum and step values.
@Suffix - for int settings, appends a suffix to the value in the ui (eg. "gp")
@Multiline - for String settings, uses a TextArea instead of a TextField
Setting Values Programmatically
Setting values can be assigned programmatically by adding a single-argument setter method to your descriptor interface, with the same key as the getter:
Last updated