Fix slayer plugin setting config values to null
null is not permitted in properties and throws an exception. Additionally mark value in setConfiguration as NonNull.
This commit is contained in:
@@ -78,6 +78,7 @@ import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
@@ -482,7 +483,7 @@ public class ConfigManager
|
||||
setConfiguration(groupName, null, key, value);
|
||||
}
|
||||
|
||||
public void setConfiguration(String groupName, String profile, String key, String value)
|
||||
public void setConfiguration(String groupName, String profile, String key, @NonNull String value)
|
||||
{
|
||||
if (Strings.isNullOrEmpty(groupName) || Strings.isNullOrEmpty(key))
|
||||
{
|
||||
|
||||
@@ -316,7 +316,14 @@ public class SlayerPlugin extends Plugin
|
||||
|
||||
private void setProfileConfig(String key, Object value)
|
||||
{
|
||||
configManager.setRSProfileConfiguration(SlayerConfig.GROUP_NAME, key, value);
|
||||
if (value != null)
|
||||
{
|
||||
configManager.setRSProfileConfiguration(SlayerConfig.GROUP_NAME, key, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
configManager.unsetRSProfileConfiguration(SlayerConfig.GROUP_NAME, key);
|
||||
}
|
||||
}
|
||||
|
||||
private void save()
|
||||
|
||||
@@ -553,6 +553,8 @@ public class SlayerPluginTest
|
||||
|
||||
assertEquals("", slayerPlugin.getTaskName());
|
||||
assertEquals(0, slayerPlugin.getAmount());
|
||||
|
||||
verify(configManager).unsetRSProfileConfiguration(SlayerConfig.GROUP_NAME, SlayerConfig.TASK_LOC_KEY);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user