|
3 | 3 | import lombok.Getter;
|
4 | 4 | import me.zort.configurationlib.configuration.Node;
|
5 | 5 | import me.zort.configurationlib.configuration.SectionNode;
|
| 6 | +import me.zort.configurationlib.configuration.SimpleNode; |
6 | 7 | import me.zort.configurationlib.util.Colorizer;
|
7 | 8 | import me.zort.configurationlib.util.ItemValidator;
|
8 | 9 | import me.zort.configurationlib.util.Placeholders;
|
|
21 | 22 | import java.lang.reflect.Field;
|
22 | 23 | import java.lang.reflect.InvocationTargetException;
|
23 | 24 | import java.util.Collection;
|
| 25 | +import java.util.List; |
24 | 26 | import java.util.Map;
|
25 | 27 | import java.util.UUID;
|
26 | 28 | import java.util.concurrent.ConcurrentHashMap;
|
@@ -52,11 +54,23 @@ public Object buildValue(Field field, Node<ConfigurationSection> node, Placehold
|
52 | 54 | // I'm specifying new field types for mapped objects.
|
53 | 55 | if(field.getType().equals(ItemStack.class) && node instanceof BukkitSectionNode) {
|
54 | 56 | return ((BukkitSectionNode) node).getAsItem(placeholders);
|
| 57 | + } else if(field.getType().equals(List.class) && node instanceof BukkitSimpleNode) { |
| 58 | + Object listCandidate = ((BukkitSimpleNode) node).get(); |
| 59 | + if(listCandidate instanceof List) { |
| 60 | + return listCandidate; |
| 61 | + } |
55 | 62 | }
|
56 | 63 | // TODO: Add support for other types.
|
57 | 64 | return super.buildValue(field, node, placeholders);
|
58 | 65 | }
|
59 | 66 |
|
| 67 | + @Override |
| 68 | + public SimpleNode<ConfigurationSection> getSimple(String path) { |
| 69 | + // Just to simplify the usage. |
| 70 | + if(!has(path)) return new BukkitSimpleNode(section, path, null); |
| 71 | + return super.getSimple(path); |
| 72 | + } |
| 73 | + |
60 | 74 | @Nullable
|
61 | 75 | @Override
|
62 | 76 | public Node<ConfigurationSection> get(String path) {
|
|
0 commit comments