ConfigGroup
Names your plugin's settings group.
AnnotationRuneLiteRuneLite docs
public @interface ConfigGroupSettings are an interface that extends Config: one default method per setting, each with @ConfigItem. The Manager shows them as your plugin's settings and saves what the player picks. @ConfigSection, @Range, @Units and @Alpha work as in RuneLite.
A Community plugin's group is community- and its slug from runelite-plugin.properties, for example @ConfigGroup("community-karambwan-fisher"). The check refuses any other group, so a plugin never reads or changes another plugin's settings.
Add a @Provides method to the plugin that returns configManager.getConfig(...) for your interface, then @Inject the interface wherever you need it. Read a setting by calling its method, for example config.bankAt(). React to changes with PluginConfigChanged.
Example
package example;
import com.google.inject.Provides;
import javax.inject.Inject;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.Keybind;
import net.runelite.client.config.Range;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@PluginDescriptor(name = "Example Settings")
public class ExamplePlugin extends Plugin {
@Inject private ExampleConfig config;
@Provides
ExampleConfig provideConfig(ConfigManager configManager) {
return configManager.getConfig(ExampleConfig.class);
}
@Override
protected void startUp() {
int bankAt = config.bankAt();
}
}
@ConfigGroup("community-example")
interface ExampleConfig extends Config {
enum Mode { KARAMBWAN, KARAMBWANJI }
@ConfigItem(keyName = "mode", name = "Mode", description = "What to fish", position = 0)
default Mode mode() { return Mode.KARAMBWAN; }
@Range(min = 1, max = 28)
@ConfigItem(keyName = "bankAt", name = "Bank at", description = "Free slots left before banking", position = 1)
default int bankAt() { return 1; }
@ConfigItem(keyName = "toggle", name = "Start/stop", description = "Starts or stops the plugin", position = 2)
default Keybind toggle() { return Keybind.NOT_SET; }
}Members
value()
String value()The group name: community- and your plugin's slug.
Also allowed
These work as in the RuneLite docs.
annotationType, clone, equals, hashCode, toString