mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Refactored ThemeConfig
This commit is contained in:
parent
638d6caaae
commit
7be0acfd70
@ -30,33 +30,7 @@ public class ThemeConfig extends Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<String> getDefaults(String fileName) throws IOException {
|
private static List<String> getDefaults(String fileName) throws IOException {
|
||||||
String fileLocation = "themes/";
|
String fileLocation = getFileLocation(fileName);
|
||||||
|
|
||||||
switch (fileName.toLowerCase()) {
|
|
||||||
case "mute":
|
|
||||||
case "lowsaturation":
|
|
||||||
fileLocation += "mute.yml";
|
|
||||||
break;
|
|
||||||
case "pastel":
|
|
||||||
case "brigth":
|
|
||||||
case "saturated":
|
|
||||||
case "high":
|
|
||||||
fileLocation += "pastel.yml";
|
|
||||||
break;
|
|
||||||
case "sepia":
|
|
||||||
case "brown":
|
|
||||||
fileLocation += "sepia.yml";
|
|
||||||
break;
|
|
||||||
case "grey":
|
|
||||||
case "gray":
|
|
||||||
case "greyscale":
|
|
||||||
case "grayscale":
|
|
||||||
fileLocation += "greyscale.yml";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fileLocation += "theme.yml";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPlan plugin = MiscUtils.getIPlan();
|
IPlan plugin = MiscUtils.getIPlan();
|
||||||
try {
|
try {
|
||||||
@ -66,10 +40,36 @@ public class ThemeConfig extends Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getFileLocation(String fileName) {
|
||||||
|
switch (fileName.toLowerCase()) {
|
||||||
|
case "mute":
|
||||||
|
case "lowsaturation":
|
||||||
|
return "themes/mute.yml";
|
||||||
|
case "pastel":
|
||||||
|
case "bright":
|
||||||
|
case "harsh":
|
||||||
|
case "saturated":
|
||||||
|
case "high":
|
||||||
|
return "themes/pastel.yml";
|
||||||
|
case "sepia":
|
||||||
|
case "brown":
|
||||||
|
return "themes/sepia.yml";
|
||||||
|
case "grey":
|
||||||
|
case "gray":
|
||||||
|
case "greyscale":
|
||||||
|
case "grayscale":
|
||||||
|
return "themes/greyscale.yml";
|
||||||
|
default:
|
||||||
|
return "themes/theme.yml";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static File getConfigFile() throws IOException {
|
private static File getConfigFile() throws IOException {
|
||||||
File folder = MiscUtils.getIPlan().getDataFolder();
|
File folder = MiscUtils.getIPlan().getDataFolder();
|
||||||
folder.mkdirs();
|
if (!folder.exists()) {
|
||||||
|
folder.mkdirs();
|
||||||
|
}
|
||||||
File themeFile = new File(folder, "theme.yml");
|
File themeFile = new File(folder, "theme.yml");
|
||||||
if (!themeFile.exists()) {
|
if (!themeFile.exists()) {
|
||||||
themeFile.createNewFile();
|
themeFile.createNewFile();
|
||||||
|
Loading…
Reference in New Issue
Block a user