Fix ConfigType

- Fixed errors with ConfigType
This commit is contained in:
Benford 2016-03-02 13:29:24 -05:00 committed by FinnBueno
parent 3410c470df
commit c4a0187e4a

View file

@ -7,31 +7,39 @@ import java.util.List;
public class ConfigType { public class ConfigType {
private static final HashMap<String, ConfigType> ALL_TYPES = new HashMap<>();
public static final ConfigType DEFAULT = new ConfigType("Default"); public static final ConfigType DEFAULT = new ConfigType("Default");
public static final ConfigType PRESETS = new ConfigType("Presets"); public static final ConfigType PRESETS = new ConfigType("Presets");
public static final ConfigType DEATH_MESSAGE = new ConfigType("DeathMessage"); public static final ConfigType DEATH_MESSAGE = new ConfigType("DeathMessage");
<<<<<<< HEAD
public static final ConfigType LANGUAGE = new ConfigType("Language"); public static final ConfigType LANGUAGE = new ConfigType("Language");
public static final ConfigType[] CORE_TYPES = {DEFAULT, PRESETS, DEATH_MESSAGE, LANGUAGE}; public static final ConfigType[] CORE_TYPES = {DEFAULT, PRESETS, DEATH_MESSAGE, LANGUAGE};
private static HashMap<String, ConfigType> allTypes = new HashMap<String, ConfigType>(); private static HashMap<String, ConfigType> allTypes = new HashMap<String, ConfigType>();
private static List<ConfigType> addonTypes = new ArrayList<ConfigType>(); private static List<ConfigType> addonTypes = new ArrayList<ConfigType>();
=======
>>>>>>> Fix ConfigType
private String string; private String string;
public ConfigType(String string) { public ConfigType(String string) {
this.string = string; this.string = string;
allTypes.put(string, this); ALL_TYPES.put(string, this);
if (!Arrays.asList(CORE_TYPES).contains(this)) {
addonTypes.add(this);
}
} }
public static List<ConfigType> addonValues() { public static List<ConfigType> addonValues() {
return addonTypes; List<ConfigType> 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() { public static List<ConfigType> coreValues() {
return CORE_TYPES; return Arrays.asList(CORE_TYPES);
} }
public String toString() { public String toString() {
@ -40,8 +48,8 @@ public class ConfigType {
public static List<ConfigType> values() { public static List<ConfigType> values() {
List<ConfigType> values = new ArrayList<>(); List<ConfigType> values = new ArrayList<>();
for (String key : allTypes.keySet()) { for (String key : ALL_TYPES.keySet()) {
values.add(allTypes.get(key)); values.add(ALL_TYPES.get(key));
} }
return values; return values;
} }