From d992bd05f455d2d90f6d77d20b3a3651bd3e063d Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 4 Jun 2023 21:07:25 -0500 Subject: [PATCH] remove IConfigEntry.setWithoutSaving() It wasn't implemented and was causing confusion since the listeners weren't being fired --- .../lod/coreapi/interfaces/config/IConfigEntry.java | 3 --- .../lod/core/config/file/ConfigFileHandling.java | 10 +++++----- .../com/seibel/lod/core/config/types/ConfigEntry.java | 8 +------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/api/src/main/java/com/seibel/lod/coreapi/interfaces/config/IConfigEntry.java b/api/src/main/java/com/seibel/lod/coreapi/interfaces/config/IConfigEntry.java index 1d70c9041..e1af75a93 100644 --- a/api/src/main/java/com/seibel/lod/coreapi/interfaces/config/IConfigEntry.java +++ b/api/src/main/java/com/seibel/lod/coreapi/interfaces/config/IConfigEntry.java @@ -23,9 +23,6 @@ public interface IConfigEntry T get(); T getTrueValue(); - /** Sets the value without saving */ - void setWithoutSaving(T newValue); - /** Gets the min value */ T getMin(); /** Sets the min value */ diff --git a/core/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java b/core/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java index 4ad9ed329..322836e69 100644 --- a/core/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java +++ b/core/src/main/java/com/seibel/lod/core/config/file/ConfigFileHandling.java @@ -124,16 +124,16 @@ public class ConfigFileHandling { if (workConfig.contains(entry.getNameWCategory())) { try { if (entry.getType().isEnum()) { - entry.setWithoutSaving((T) ( workConfig.getEnum(entry.getNameWCategory(), (Class) entry.getType()) )); + entry.set((T) ( workConfig.getEnum(entry.getNameWCategory(), (Class) entry.getType()) )); } else if (ConfigTypeConverters.convertObjects.containsKey(entry.getType())) { - entry.setWithoutSaving((T) ConfigTypeConverters.convertFromString(entry.getType(), workConfig.get(entry.getNameWCategory()))); + entry.set((T) ConfigTypeConverters.convertFromString(entry.getType(), workConfig.get(entry.getNameWCategory()))); } else { if (entry.getType() == workConfig.get(entry.getNameWCategory()).getClass()) { // If the types are the same - entry.setWithoutSaving((T) workConfig.get(entry.getNameWCategory())); + entry.set((T) workConfig.get(entry.getNameWCategory())); if (entry.isValid() == 0) return; - else if (entry.isValid() == -1) entry.setWithoutSaving(entry.getMin()); - else if (entry.isValid() == 1) entry.setWithoutSaving(entry.getMax()); + else if (entry.isValid() == -1) entry.set(entry.getMin()); + else if (entry.isValid() == 1) entry.set(entry.getMax()); } else { LOGGER.warn("Entry ["+ entry.getNameWCategory() +"] is invalid. Expected " + entry.getType() + " but got " + workConfig.get(entry.getNameWCategory()).getClass() + ". Using default value."); saveEntry(entry, workConfig); diff --git a/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java b/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java index d2657a4e9..b43fa1950 100644 --- a/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java +++ b/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java @@ -89,13 +89,7 @@ public class ConfigEntry extends AbstractConfigType> implem public T getTrueValue() { return super.get(); } - - /** Sets the value without saving */ - @Override - public void setWithoutSaving(T newValue) { - super.set(newValue); - } - + /** Gets the min value */ @Override public T getMin() {