From 65419ac20d524e6faf25d4a153d3eb6db21bd794 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Thu, 31 Oct 2019 01:55:29 +0100 Subject: [PATCH] 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 --- BuildConfigUpdater/BuildConfigUpdater.iml | 1 - .../main/java/buttondevteam/lib/architecture/ConfigData.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/BuildConfigUpdater/BuildConfigUpdater.iml b/BuildConfigUpdater/BuildConfigUpdater.iml index 04dfdc0..67aa057 100644 --- a/BuildConfigUpdater/BuildConfigUpdater.iml +++ b/BuildConfigUpdater/BuildConfigUpdater.iml @@ -18,7 +18,6 @@ - diff --git a/ButtonCore/src/main/java/buttondevteam/lib/architecture/ConfigData.java b/ButtonCore/src/main/java/buttondevteam/lib/architecture/ConfigData.java index 2d74f3e..4cd683c 100644 --- a/ButtonCore/src/main/java/buttondevteam/lib/architecture/ConfigData.java +++ b/ButtonCore/src/main/java/buttondevteam/lib/architecture/ConfigData.java @@ -89,7 +89,7 @@ public class ConfigData { 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