Fixes a few bugs regarding the new sign color system
Fixes missing STRING_LIST in loadConfig switch Fixes missing color valid check in loadGateConfig Fixes typing of PER_SIGN_COLORS
This commit is contained in:
		@@ -51,8 +51,8 @@ public enum ConfigOption {
 | 
			
		||||
    HIGHLIGHT_SIGN_COLOR("gates.cosmetic.highlightSignColor", "The text color used for highlighting stargate signs", "WHITE"),
 | 
			
		||||
 | 
			
		||||
    PER_SIGN_COLORS("gates.cosmetic.perSignColors", "The per-sign color specification", new String[]{
 | 
			
		||||
            "ACACIA:default,default", "BIRCH:default,default", "CRIMSON:default,default", "DARK_OAK:default,default",
 | 
			
		||||
            "JUNGLE:default,default", "OAK:default,default", "SPRUCE:default,default", "WARPED:default,default"}),
 | 
			
		||||
            "'ACACIA:default,default'", "'BIRCH:default,default'", "'CRIMSON:WHITE,BLACK'", "'DARK_OAK:WHITE,BLACK'",
 | 
			
		||||
            "'JUNGLE:default,default'", "'OAK:default,default'", "'SPRUCE:WHITE,BLACK'", "'WARPED:WHITE,BLACK'"}),
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Whether to destroy portals when any blocks are broken by explosions
 | 
			
		||||
@@ -185,7 +185,7 @@ public enum ConfigOption {
 | 
			
		||||
        } else if (defaultValue instanceof Integer) {
 | 
			
		||||
            this.dataType = OptionDataType.INTEGER;
 | 
			
		||||
        } else {
 | 
			
		||||
            throw new IllegalArgumentException("Unknown config data type encountered.");
 | 
			
		||||
            throw new IllegalArgumentException("Unknown config data type encountered: " + defaultValue);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -351,6 +351,7 @@ public final class StargateConfig {
 | 
			
		||||
 | 
			
		||||
            //Load the option using its correct data type
 | 
			
		||||
            switch (option.getDataType()) {
 | 
			
		||||
                case STRING_LIST -> optionValue = newConfig.getStringList(configNode);
 | 
			
		||||
                case STRING -> {
 | 
			
		||||
                    String value = newConfig.getString(configNode);
 | 
			
		||||
                    optionValue = value != null ? value.trim() : "";
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@ import net.md_5.bungee.api.ChatColor;
 | 
			
		||||
import org.bukkit.Material;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -182,18 +183,18 @@ public final class StargateGateConfig {
 | 
			
		||||
        //Load the sign colors
 | 
			
		||||
        loadSignColor((String) configOptions.get(ConfigOption.MAIN_SIGN_COLOR),
 | 
			
		||||
                (String) configOptions.get(ConfigOption.HIGHLIGHT_SIGN_COLOR));
 | 
			
		||||
        String[] perSignColors = (String[]) configOptions.get(ConfigOption.PER_SIGN_COLORS);
 | 
			
		||||
        List<?> perSignColors = (List<?>) configOptions.get(ConfigOption.PER_SIGN_COLORS);
 | 
			
		||||
 | 
			
		||||
        Map<Material, ChatColor> signMainColors = new HashMap<>();
 | 
			
		||||
        Map<Material, ChatColor> signHighlightColors = new HashMap<>();
 | 
			
		||||
        for (String signColorSpecification : perSignColors) {
 | 
			
		||||
            String[] specificationData = signColorSpecification.split(":");
 | 
			
		||||
        for (Object signColorSpecification : perSignColors) {
 | 
			
		||||
            String[] specificationData = String.valueOf(signColorSpecification).split(":");
 | 
			
		||||
            String[] colors = specificationData[1].split(",");
 | 
			
		||||
            if (!colors[0].equalsIgnoreCase("default")) {
 | 
			
		||||
            if (!colors[0].equalsIgnoreCase("default") && ChatColor.of(colors[0]) != null) {
 | 
			
		||||
                signMainColors.put(Material.matchMaterial(specificationData[0] + "_SIGN"), ChatColor.of(colors[0]));
 | 
			
		||||
                signMainColors.put(Material.matchMaterial(specificationData[0] + "_WALL_SIGN"), ChatColor.of(colors[0]));
 | 
			
		||||
            }
 | 
			
		||||
            if (!colors[1].equalsIgnoreCase("default")) {
 | 
			
		||||
            if (!colors[1].equalsIgnoreCase("default") && ChatColor.of(colors[1]) != null) {
 | 
			
		||||
                signHighlightColors.put(Material.matchMaterial(specificationData[0] + "_SIGN"), ChatColor.of(colors[1]));
 | 
			
		||||
                signHighlightColors.put(Material.matchMaterial(specificationData[0] + "_WALL_SIGN"), ChatColor.of(colors[1]));
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user