Save read-only data even if def isn't null
If the default isn't null (for Discord, it could find the channel) then it'd use set() - but that isn't allowed to do anything, so the value isn't saved
This commit is contained in:
parent
7de1d0575c
commit
65419ac20d
2 changed files with 1 additions and 2 deletions
|
@ -18,7 +18,6 @@
|
|||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
|
||||
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
|
||||
|
|
|
@ -89,7 +89,7 @@ public class ConfigData<T> {
|
|||
val = primitiveDef;
|
||||
}
|
||||
if (!saved && Objects.equals(val, primitiveDef)) { //String needs .equals()
|
||||
if (def == null && config != null) //In Discord's case def may be null
|
||||
if ((def == null || this instanceof ReadOnlyConfigData) && config != null) //In Discord's case def may be null
|
||||
config.set(path, primitiveDef);
|
||||
else
|
||||
set(def); //Save default value - def is always set
|
||||
|
|
Loading…
Reference in a new issue