Change to fit Rpg configs

- Changed configtype to not be an enum
- Removed an unused import
- Edited configmanager to match ConfigType
This commit is contained in:
Benford 2016-02-29 15:36:19 -05:00
parent 47ba35b760
commit e332875e1b
3 changed files with 973 additions and 954 deletions

View file

@ -12,7 +12,6 @@ import com.projectkorra.projectkorra.waterbending.WaterArms;
import com.projectkorra.projectkorra.waterbending.WaterSpout; import com.projectkorra.projectkorra.waterbending.WaterSpout;
import com.projectkorra.rpg.RPGMethods; import com.projectkorra.rpg.RPGMethods;
import org.bukkit.Bukkit;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;

View file

@ -1,22 +1,47 @@
package com.projectkorra.projectkorra.configuration; package com.projectkorra.projectkorra.configuration;
/** import java.util.ArrayList;
* Enum representing different types of Configurations. import java.util.Arrays;
* import java.util.HashMap;
* @author Jacklin213 import java.util.List;
*
*/ public class ConfigType {
public enum ConfigType {
/** public static final ConfigType DEFAULT = new ConfigType("Default");
* Default Configuration represented by config.yml public static final ConfigType PRESETS = new ConfigType("Presets");
*/ public static final ConfigType DEATH_MESSAGE = new ConfigType("DeathMessage");
DEFAULT, public static final ConfigType[] CORE_TYPES = {DEFAULT, PRESETS, DEATH_MESSAGE};
/**
* Death Message configuration represented by deathmessages.yml private static HashMap<String, ConfigType> allTypes = new HashMap<>();
*/ private static List<ConfigType> addonTypes = new ArrayList<>();
DEATH_MESSAGE,
/** private String string;
* Preset configuration represented by presets.yml
*/ public ConfigType(String string) {
PRESETS; this.string = string;
allTypes.put(string, this);
if (!Arrays.asList(CORE_TYPES).contains(this)) {
addonTypes.add(this);
}
}
public static List<ConfigType> addonValues() {
return addonTypes;
}
public static ConfigType[] coreValues() {
return CORE_TYPES;
}
public String toString() {
return string;
}
public static List<ConfigType> values() {
List<ConfigType> values = new ArrayList<>();
for (String key : allTypes.keySet()) {
values.add(allTypes.get(key));
}
return values;
}
} }