Fixed configs not showing up in the GUI, if the field name and the annotation name don't match

This commit is contained in:
Ven committed 2023-09-12 07:25:42 +01:00
1 parent aaba678d37
commit b1df7dc4b2
1 file changed
+3 -1
@@ -180,7 +180,9 @@ public class ParsedConfiguration {
field.setAccessible(true); field.setAccessible(true);
maxFieldNameLength = Math.max(maxFieldNameLength, field.getName().length()); maxFieldNameLength = Math.max(maxFieldNameLength, field.getName().length());
val fieldClass = field.getType(); val fieldClass = field.getType();
val name = field.getName(); val name = Optional.ofNullable(field.getAnnotation(Config.Name.class))
.map(Config.Name::value)
.orElse(field.getName());
AConfigField<?> configField; AConfigField<?> configField;
if (constructors.containsKey(fieldClass)) { if (constructors.containsKey(fieldClass)) {
fields.put(name, configField = constructors.get(fieldClass).construct(field, rawConfig, category)); fields.put(name, configField = constructors.get(fieldClass).construct(field, rawConfig, category));