本文整理汇总了Java中org.bukkit.configuration.file.FileConfiguration.get方法的典型用法代码示例。如果您正苦于以下问题:Java FileConfiguration.get方法的具体用法?Java FileConfiguration.get怎么用?Java FileConfiguration.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.configuration.file.FileConfiguration
的用法示例。
在下文中一共展示了FileConfiguration.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restoreNodes
import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public static void restoreNodes(Coord<File, FileConfiguration> coord, Class<? extends Configurable> clazz) throws IllegalArgumentException, IllegalAccessException, IOException {
FileConfiguration config = coord.getValue();
for (Field field : clazz.getDeclaredFields()) {
Node node = field.getAnnotation(Node.class);
if (node == null) continue;
field.setAccessible(true);
Object def = field.get(null);
int mod = field.getModifiers();
if (Modifier.isStatic(mod) && !Modifier.isFinal(mod)) {
String path = node.path();
Object value = config.get(path);
if (value == null) {
config.set(path, def);
field.set(null, AzureAPI.colorzine(def)); // for colorzine
} else {
field.set(null, AzureAPI.colorzine(value));
}
}
}
config.save(coord.getKey());
}
示例2: verificateEntries
import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void verificateEntries() {
PluginMessage.VERIFICATE_CONFIG.show();
FileConfiguration config = plugin.getConfig();
// Check, if all entries are all initialized:
for (ConfigFile nextEntry : ConfigFile.values()) {
Object nextObject = config.get(nextEntry.getName());
if (nextObject == null) {
throw new AssertNullPointerException("Your config file has missing entries. Please recheck and retry!");
}
}
}
示例3: validateConfig
import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
/**
* Validates the config.
*
* @param config The config to validate.
* @return True if the config is valid, false otherwise.
*/
private boolean validateConfig(FileConfiguration config) {
try {
return config.get("shortcuts") != null && config.get("disabled-emojis") != null
&& config.get("fix-emoji-coloring") != null && config.get("disable-emojis") != null
&& config.get("pack-variant") != null;
} catch (Exception e) {
return false;
}
}
示例4: fieldSet
import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
private static void fieldSet(Field f, FileConfiguration config, Object instance, String key) throws IllegalAccessException {
if (config.get(key) instanceof Boolean) {
f.set(instance, config.getBoolean(key));
} else if (config.get(key) instanceof Integer) {
f.set(instance, config.getInt(key));
} else if (config.get(key) instanceof ConfigurationSection) {
f.set(instance, f.getType().cast(((ConfigurationSection) config.get(key)).getValues(false)));
} else {
f.set(instance, f.getType().cast(config.get(key)));
}
}