|
22 | 22 | package io.github.kvverti.colormatic.resource;
|
23 | 23 |
|
24 | 24 | import java.util.Collection;
|
| 25 | +import java.util.regex.Pattern; |
25 | 26 |
|
26 | 27 | import io.github.kvverti.colormatic.colormap.BiomeColormap;
|
27 | 28 | import io.github.kvverti.colormatic.colormap.BiomeColormaps;
|
|
42 | 43 | */
|
43 | 44 | public class CustomBiomeColormapsResource implements SimpleSynchronousResourceReloadListener {
|
44 | 45 |
|
45 |
| - private static final Logger log = LogManager.getLogger(); |
| 46 | + private static final Logger log = LogManager.getLogger("Colormatic"); |
| 47 | + private static final Pattern ID_PATTERN = Pattern.compile("[a-z0-9_/.-]+"); |
46 | 48 |
|
47 | 49 | private final Identifier id;
|
48 | 50 | private final Identifier optifineId;
|
@@ -82,12 +84,15 @@ private static void addColormaps(ResourceManager manager, Identifier dir, boolea
|
82 | 84 | .distinct()
|
83 | 85 | .collect(toList());
|
84 | 86 | for(Identifier id : files) {
|
| 87 | + if(!ID_PATTERN.matcher(id.getPath()).matches()) { |
| 88 | + log.error("Non-ASCII colormap definition file {}. Please contact resource pack author to fix.", id); |
| 89 | + } |
85 | 90 | try {
|
86 | 91 | PropertyImage pi = PropertyUtil.loadColormap(manager, id, true);
|
87 | 92 | BiomeColormap colormap = new BiomeColormap(pi.properties(), pi.image());
|
88 | 93 | BiomeColormaps.add(colormap);
|
89 | 94 | } catch(InvalidColormapException e) {
|
90 |
| - log.warn("Error parsing {}: {}", id, e.getMessage()); |
| 95 | + log.error("Error parsing {}: {}", id, e.getMessage()); |
91 | 96 | }
|
92 | 97 | }
|
93 | 98 | }
|
|
0 commit comments