Search in sources :

Example 6 with ConfigChanged

use of net.runelite.api.events.ConfigChanged in project runelite by runelite.

the class ConfigManager method unsetConfiguration.

public void unsetConfiguration(String groupName, String key) {
    log.debug("Unsetting configuration value for {}.{}", groupName, key);
    String oldValue = (String) properties.remove(groupName + "." + key);
    if (client != null) {
        final Runnable task = () -> {
            try {
                client.unset(groupName + "." + key);
            } catch (IOException ex) {
                log.warn("unable to set configuration item", ex);
            }
        };
        executor.execute(task);
    }
    Runnable task = () -> {
        try {
            saveToFile();
        } catch (IOException ex) {
            log.warn("unable to save configuration file", ex);
        }
    };
    executor.execute(task);
    ConfigChanged configChanged = new ConfigChanged();
    configChanged.setGroup(groupName);
    configChanged.setKey(key);
    configChanged.setOldValue(oldValue);
    eventBus.post(configChanged);
}
Also used : ConfigChanged(net.runelite.api.events.ConfigChanged) IOException(java.io.IOException)

Aggregations

ConfigChanged (net.runelite.api.events.ConfigChanged)6 IOException (java.io.IOException)4 Skill (net.runelite.api.Skill)2 VarbitChanged (net.runelite.api.events.VarbitChanged)2 Test (org.junit.Test)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 Map (java.util.Map)1 Widget (net.runelite.api.widgets.Widget)1 ConfigEntry (net.runelite.http.api.config.ConfigEntry)1 Configuration (net.runelite.http.api.config.Configuration)1