mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 10:43:14 +00:00
Default values
This commit is contained in:
parent
9e51a1617f
commit
639294af2d
@ -3,6 +3,7 @@ package com.volmit.iris.manager;
|
|||||||
import java.awt.GraphicsEnvironment;
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@ -90,7 +91,7 @@ public class SchemaBuilder
|
|||||||
JSONObject o = new JSONObject();
|
JSONObject o = new JSONObject();
|
||||||
JSONObject properties = new JSONObject();
|
JSONObject properties = new JSONObject();
|
||||||
o.put("description", getDescription(c));
|
o.put("description", getDescription(c));
|
||||||
|
o.put("type", getType(c));
|
||||||
JSONArray required = new JSONArray();
|
JSONArray required = new JSONArray();
|
||||||
|
|
||||||
for(Field k : c.getDeclaredFields())
|
for(Field k : c.getDeclaredFields())
|
||||||
@ -821,6 +822,36 @@ public class SchemaBuilder
|
|||||||
d.add(" ");
|
d.add(" ");
|
||||||
d.add(fancyType);
|
d.add(fancyType);
|
||||||
d.add(getDescription(k.getType()));
|
d.add(getDescription(k.getType()));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
k.setAccessible(true);
|
||||||
|
Object value = k.get(cl.newInstance());
|
||||||
|
|
||||||
|
if(value != null)
|
||||||
|
{
|
||||||
|
if(value instanceof List)
|
||||||
|
{
|
||||||
|
d.add("* Default Value is an empty list");
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(!cl.isPrimitive() && !(value instanceof Number) && !(value instanceof String) && !(cl.isEnum()))
|
||||||
|
{
|
||||||
|
d.add("* Default Value is a default object (create this object to see default properties)");
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d.add("* Default Value is " + value.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(Throwable e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
description.forEach((g) -> d.add(g.trim()));
|
description.forEach((g) -> d.add(g.trim()));
|
||||||
prop.put("type", type);
|
prop.put("type", type);
|
||||||
prop.put("description", d.toString("\n"));
|
prop.put("description", d.toString("\n"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user