Fix config comments, improve pregen
Also only showing a warning if something is missing from the command yml
This commit is contained in:
parent
51e0ca4f4c
commit
c12a24895e
4 changed files with 11 additions and 5 deletions
|
@ -69,15 +69,19 @@ public class ConfigProcessor {
|
|||
if (doc == null) continue;
|
||||
System.out.println("DOC: " + doc);
|
||||
yc.set(path + "." + e.getSimpleName(), doc.trim());
|
||||
/*System.out.println("Set " + path + "." + e.getSimpleName() + " to " + doc.trim());
|
||||
System.out.println("Check: " + yc.getString(path + "." + e.getSimpleName()));
|
||||
System.out.println("Wut2: " + yc.getString("components.MemberComponent.memberGroup"));*/
|
||||
}
|
||||
String javadoc = procEnv.getElementUtils().getDocComment(targetcl);
|
||||
if (javadoc != null) {
|
||||
System.out.println("JAVADOC");
|
||||
System.out.println(javadoc.trim());
|
||||
yc.set(path, javadoc.trim());
|
||||
yc.set(path + ".generalDescriptionInsteadOfAConfig", javadoc.trim());
|
||||
}
|
||||
try {
|
||||
yc.save(file);
|
||||
//System.out.println("Wut: " + yc.getString("components.MemberComponent.memberGroup"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -124,7 +124,8 @@ public abstract class ButtonPlugin extends JavaPlugin {
|
|||
var yc = YamlConfiguration.loadConfiguration(res);
|
||||
for (var kv : yc.getValues(true).entrySet())
|
||||
if (kv.getValue() instanceof String)
|
||||
yaml.addComment(kv.getKey(), Arrays.stream(((String) kv.getValue()).split("\n"))
|
||||
yaml.addComment(kv.getKey().replace(".generalDescriptionInsteadOfAConfig", ""),
|
||||
Arrays.stream(((String) kv.getValue()).split("\n"))
|
||||
.map(str -> "# " + str.trim()).toArray(String[]::new));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ public class ConfigData<T> {
|
|||
this.primitiveDef = primitiveDef;
|
||||
this.getter = getter;
|
||||
this.setter = setter;
|
||||
get(); //Generate config automatically
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -373,9 +373,9 @@ public abstract class Command2<TC extends ICommand2<TP>, TP extends Command2Send
|
|||
} else
|
||||
TBMCCoreAPI.SendException("Error while getting command data for " + method + "!", new Exception("Method '" + method.toString() + "' != " + mname + " or params is " + params), MainPlugin.Instance);
|
||||
} else
|
||||
TBMCCoreAPI.SendException("Error while getting command data for " + method + "!", new Exception("cs is " + cs), MainPlugin.Instance);
|
||||
MainPlugin.Instance.getLogger().warning("Failed to get command data for " + method + " (cs is null)! Make sure to use 'clean install' when building the project.");
|
||||
} else
|
||||
TBMCCoreAPI.SendException("Error while getting command data for " + method + "!", new Exception("ccs is " + ccs + " - class: " + method.getDeclaringClass().getCanonicalName()), MainPlugin.Instance);
|
||||
MainPlugin.Instance.getLogger().warning("Failed to get command data for " + method + " (ccs is null)! Make sure to use 'clean install' when building the project.");
|
||||
}
|
||||
return ht;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue