Config fix

Saving primitive defaults even if def is null
This commit is contained in:
Norbi Peti 2019-03-09 01:51:13 +01:00
parent 138259412f
commit 9620ae44f6
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56

View file

@ -56,6 +56,9 @@ public class ConfigData<T> { //TODO: Save after a while
val = primitiveDef; val = primitiveDef;
} }
if (!saved && Objects.equals(val, primitiveDef)) { //String needs .equals() if (!saved && Objects.equals(val, primitiveDef)) { //String needs .equals()
if (def == null && config != null) //In Discord's case def may be null
config.set(path, primitiveDef);
else
set(def); //Save default value - def is always set set(def); //Save default value - def is always set
saved = true; saved = true;
} }