/**
* Reads plugin.yml and returns the defined commands by main label and aliases.
*
* @return collection of all labels and their aliases
*/
@SuppressWarnings("unchecked")
private static Map<String, List<String>> getLabelsFromPluginFile() {
FileConfiguration pluginFile = YamlConfiguration.loadConfiguration(getJarFile("/plugin.yml"));
MemorySection commandList = (MemorySection) pluginFile.get("commands");
Map<String, Object> commandDefinitions = commandList.getValues(false);
Map<String, List<String>> commandLabels = new HashMap<>();
for (Map.Entry<String, Object> commandDefinition : commandDefinitions.entrySet()) {
MemorySection definition = (MemorySection) commandDefinition.getValue();
List<String> alternativeLabels = definition.get("aliases") == null
? Collections.EMPTY_LIST
: (List<String>) definition.get("aliases");
commandLabels.put(commandDefinition.getKey(), alternativeLabels);
}
return commandLabels;
}
CommandConsistencyTest.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:AuthMeReloaded
作者:
评论列表
文章目录