remove IConfigEntry.setWithoutSaving()
It wasn't implemented and was causing confusion since the listeners weren't being fired
This commit is contained in:
@@ -23,9 +23,6 @@ public interface IConfigEntry<T>
|
||||
T get();
|
||||
T getTrueValue();
|
||||
|
||||
/** Sets the value without saving */
|
||||
void setWithoutSaving(T newValue);
|
||||
|
||||
/** Gets the min value */
|
||||
T getMin();
|
||||
/** Sets the min value */
|
||||
|
||||
@@ -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<? extends Enum>) entry.getType()) ));
|
||||
entry.set((T) ( workConfig.getEnum(entry.getNameWCategory(), (Class<? extends Enum>) 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);
|
||||
|
||||
@@ -89,13 +89,7 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> 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() {
|
||||
|
||||
Reference in New Issue
Block a user