mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Working snippets (without autocomplete)
This commit is contained in:
parent
875adc8bdf
commit
2a22d25975
@ -405,7 +405,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
|||||||
|
|
||||||
if(r.startsWith("snippet/" + snippetType + "/"))
|
if(r.startsWith("snippet/" + snippetType + "/"))
|
||||||
{
|
{
|
||||||
File f = new File(getDataFolder(), r);
|
File f = new File(getDataFolder(), r + ".json");
|
||||||
|
|
||||||
if(f.exists())
|
if(f.exists())
|
||||||
{
|
{
|
||||||
|
@ -523,20 +523,30 @@ public class SchemaBuilder {
|
|||||||
d.add(fancyType);
|
d.add(fancyType);
|
||||||
d.add(getDescription(k.getType()));
|
d.add(getDescription(k.getType()));
|
||||||
|
|
||||||
|
if(k.getType().isAnnotationPresent(Snippet.class))
|
||||||
|
{
|
||||||
|
String sm = k.getType().getDeclaredAnnotation(Snippet.class).value();
|
||||||
|
d.add(" ");
|
||||||
|
d.add("You can instead specify \"snippet/" + sm + "/some-name.json\" to use a snippet file instead of specifying it here.");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
k.setAccessible(true);
|
k.setAccessible(true);
|
||||||
Object value = k.get(cl.newInstance());
|
Object value = k.get(cl.newInstance());
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
if (value instanceof List) {
|
if (value instanceof List) {
|
||||||
|
d.add(" ");
|
||||||
d.add("* Default Value is an empty list");
|
d.add("* Default Value is an empty list");
|
||||||
} else if (!cl.isPrimitive() && !(value instanceof Number) && !(value instanceof String) && !(cl.isEnum())) {
|
} else if (!cl.isPrimitive() && !(value instanceof Number) && !(value instanceof String) && !(cl.isEnum())) {
|
||||||
|
d.add(" ");
|
||||||
d.add("* Default Value is a default object (create this object to see default properties)");
|
d.add("* Default Value is a default object (create this object to see default properties)");
|
||||||
} else {
|
} else {
|
||||||
|
d.add(" ");
|
||||||
d.add("* Default Value is " + value);
|
d.add("* Default Value is " + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user