Skip to content

Commit b1df7dc

Browse files
committed
Fixed configs not showing up in the GUI, if the field name and the annotation name don't match
1 parent aaba678 commit b1df7dc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/com/falsepattern/lib/internal/impl/config/ParsedConfiguration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ public void reloadFields() throws ConfigException, IllegalAccessException {
180180
field.setAccessible(true);
181181
maxFieldNameLength = Math.max(maxFieldNameLength, field.getName().length());
182182
val fieldClass = field.getType();
183-
val name = field.getName();
183+
val name = Optional.ofNullable(field.getAnnotation(Config.Name.class))
184+
.map(Config.Name::value)
185+
.orElse(field.getName());
184186
AConfigField<?> configField;
185187
if (constructors.containsKey(fieldClass)) {
186188
fields.put(name, configField = constructors.get(fieldClass).construct(field, rawConfig, category));

0 commit comments

Comments
 (0)