From c4a0187e4a97970dbf027be7b8634a29f0882137 Mon Sep 17 00:00:00 2001 From: Benford Date: Wed, 2 Mar 2016 13:29:24 -0500 Subject: [PATCH] Fix ConfigType - Fixed errors with ConfigType --- .../configuration/ConfigType.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigType.java b/src/com/projectkorra/projectkorra/configuration/ConfigType.java index 1b18df31..2919d7de 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigType.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigType.java @@ -7,31 +7,39 @@ 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"); +<<<<<<< HEAD public static final ConfigType LANGUAGE = new ConfigType("Language"); public static final ConfigType[] CORE_TYPES = {DEFAULT, PRESETS, DEATH_MESSAGE, LANGUAGE}; private static HashMap allTypes = new HashMap(); private static List addonTypes = new ArrayList(); +======= +>>>>>>> Fix ConfigType 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() { @@ -40,8 +48,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; }