Fix groupColorPriority list automatically; resolves #174

This commit is contained in:
Daniel Saukel 2016-12-01 16:04:28 +01:00
parent 15a7e586dd
commit babe7acd80
9 changed files with 28 additions and 12 deletions

View File

@ -8,6 +8,6 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1-SNAPSHOT</version>
<version>0.15.1</version>
</parent>
</project>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1-SNAPSHOT</version>
<version>0.15.1</version>
</parent>
<build>
<resources>

View File

@ -24,11 +24,14 @@ import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.util.DColor;
import static io.github.dre2n.dungeonsxl.util.DColor.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.configuration.ConfigurationSection;
/**
@ -506,10 +509,23 @@ public class MainConfig extends BRConfig {
}
if (config.contains("groupColorPriority")) {
groupColorPriority.clear();
for (String color : config.getStringList("groupColorPriority")) {
if (EnumUtil.isValidEnum(DColor.class, color)) {
groupColorPriority.add(DColor.valueOf(color));
if (config.getStringList("groupColorPriority").size() < 15) {
ArrayList<String> strings = new ArrayList<>();
for (DColor color : groupColorPriority) {
strings.add(color.toString());
}
config.set("groupColorPriority", strings);
try {
config.save(file);
} catch (IOException exception) {
}
} else {
groupColorPriority.clear();
for (String color : config.getStringList("groupColorPriority")) {
if (EnumUtil.isValidEnum(DColor.class, color)) {
groupColorPriority.add(DColor.valueOf(color));
}
}
}
}

View File

@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1-SNAPSHOT</version>
<version>0.15.1</version>
</parent>
<build>
<plugins>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1-SNAPSHOT</version>
<version>0.15.1</version>
</parent>
<build>
<plugins>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1-SNAPSHOT</version>
<version>0.15.1</version>
</parent>
<build>
<plugins>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1-SNAPSHOT</version>
<version>0.15.1</version>
</parent>
<build>
<plugins>

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1-SNAPSHOT</version>
<version>0.15.1</version>
<packaging>pom</packaging>
<name>DungeonsXL</name>
<url>https://dre2n.github.io</url>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1-SNAPSHOT</version>
<version>0.15.1</version>
</parent>
<build>
<finalName>dungeonsxl-${project.version}${buildNo}</finalName>