diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigType.java b/src/com/projectkorra/projectkorra/configuration/ConfigType.java index 8f65f121..ace77618 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigType.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigType.java @@ -7,30 +7,33 @@ import java.util.List; public class ConfigType { + private static final HashMap ALL_TYPES = new HashMap<>(); + public static final ConfigType DEFAULT = new ConfigType("Default"); public static final ConfigType PRESETS = new ConfigType("Presets"); public static final ConfigType DEATH_MESSAGE = new ConfigType("DeathMessage"); - public static final ConfigType[] CORE_TYPES = {DEFAULT, PRESETS, DEATH_MESSAGE}; - private static HashMap allTypes = new HashMap<>(); - private static List addonTypes = new ArrayList<>(); + private static final ConfigType[] CORE_TYPES = {DEFAULT, PRESETS, DEATH_MESSAGE}; private String string; public ConfigType(String string) { this.string = string; - allTypes.put(string, this); - if (!Arrays.asList(CORE_TYPES).contains(this)) { - addonTypes.add(this); - } + ALL_TYPES.put(string, this); } public static List addonValues() { - return addonTypes; + List values = new ArrayList<>(); + for (String key : ALL_TYPES.keySet()) { + if (!Arrays.asList(CORE_TYPES).contains(ALL_TYPES.get(key))) { + values.add(ALL_TYPES.get(key)); + } + } + return values; } - public static ConfigType[] coreValues() { - return CORE_TYPES; + public static List coreValues() { + return Arrays.asList(CORE_TYPES); } public String toString() { @@ -39,8 +42,8 @@ public class ConfigType { public static List values() { List values = new ArrayList<>(); - for (String key : allTypes.keySet()) { - values.add(allTypes.get(key)); + for (String key : ALL_TYPES.keySet()) { + values.add(ALL_TYPES.get(key)); } return values; }