rt 
如果config是这样的
我该如何获取Msg下所有的list呢? 只获取"list"或者"list2"这个数字 并且不要返回null
如果config是这样的
我该如何获取Msg下所有的list呢? 只获取"list"或者"list2"这个数字 并且不要返回null
- public java.util.Set<java.lang.String> getKeys(boolean deep)
 
- 从接口复制的说明: ConfigurationSection
 
- 获取此配置文件的键集合.
 
- 如果为 true, 则返回包括所有的能访问到的键的集合. 类似于获取硬盘中第一层目录还是遍历全部子目录.
 
 
- 例如:
 
 
- top1. Second1
 
 
- top1. Second2
 
 
- top2. Second1
 
 
- top2. Second2
 
 
- 原文: Gets a set containing all keys in this section.
 
 
- If deep is set to true, then this will contain all the keys within any child ConfigurationSections (and their children, etc). These will be in a valid path notation for you to use.
 
 
- If deep is set to false, then this will contain only the keys of any direct children, and not their own children.
 
 
- 指定者:
 
- getKeys 在接口中 ConfigurationSection
 
- 参数:
 
- deep - 获取全部键, 或者仅仅获取表层键.
 
- 返回:
 
- 将返回一个 set, 装载着符合要求的键.
config.getConfigurationSection("Msg").getKeys(false)
返回包含 list 和 list2 的字符串集合
返回包含 list 和 list2 的字符串集合
结冰的离季 发表于 2022-8-20 13:20
config.getConfigurationSection("Msg").getKeys(false)
返回包含 list 和 list2 的字符串集合
我就这样写的,然后获取之后a,b那些值的时候直接null
TCmc 发表于 2022-8-20 20:42
我就这样写的,然后获取之后a,b那些值的时候直接null
你得确保你的配置正确加载
TCmc 发表于 2022-8-20 20:42
我就这样写的,然后获取之后a,b那些值的时候直接null
贴一下你的写法
TCmc 发表于 2022-8-21 19:44
我是这样写的 新手写法勿喷
arg[1]是正确的
("Msg."+arg[1]+"a");
这里修改成
("Msg."+arg[1]+".a");
这里修改成
("Msg."+arg[1]+".a");
Msg.list.a嘛
其他代码没啥问题
TCmc 发表于 2022-8-22 11:48
但就是null 我人麻了
加我q我远程你看看