本文整理了Java中org.bukkit.configuration.file.YamlConfiguration.loadConfiguration()
方法的一些代码示例,展示了YamlConfiguration.loadConfiguration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlConfiguration.loadConfiguration()
方法的具体详情如下:
包路径:org.bukkit.configuration.file.YamlConfiguration
类名称:YamlConfiguration
方法名:loadConfiguration
[英]Creates a new YamlConfiguration, loading from the given file.
Any errors loading the Configuration will be logged and then ignored. If the specified input is not a valid config, a blank config will be returned.
The encoding used may follow the system dependent default.
[中]创建新的YamlConfiguration,从给定文件加载。
加载配置时出现的任何错误都将被记录,然后被忽略。如果指定的输入不是有效的配置,将返回一个空配置。
使用的编码可能遵循依赖于系统的默认值。
代码示例来源:origin: GlowstoneMC/Glowstone
/**
* Creates the instance.
*/
public FishingRewardManager() {
YamlConfiguration builtinValues = YamlConfiguration.loadConfiguration(
new InputStreamReader(getClass().getClassLoader()
.getResourceAsStream("builtin/fishingRewards.yml")));
registerBuiltins(builtinValues);
}
代码示例来源:origin: GlowstoneMC/Glowstone
/**
* Creates a MaterialValueManager using the data from the resource file
* {@code builtin/materialValues.yml} in the Glowstone jar.
*/
public BuiltinMaterialValueManager() {
values = new EnumMap<>(Material.class);
YamlConfiguration builtinValues = YamlConfiguration.loadConfiguration(new InputStreamReader(
getClass().getClassLoader().getResourceAsStream("builtin/materialValues.yml")));
defaultValue = new BuiltinValueCollection(
builtinValues.getConfigurationSection("default")); // NON-NLS
registerBuiltins(builtinValues);
}
代码示例来源:origin: Bukkit/Bukkit
@SuppressWarnings("deprecation")
@Override
public void reloadConfig() {
newConfig = YamlConfiguration.loadConfiguration(configFile);
defConfig = YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8));
} else {
final byte[] contents;
代码示例来源:origin: GlowstoneMC/Glowstone
.loadConfiguration(new InputStreamReader(in));
代码示例来源:origin: com.greatmancode/tools
public BukkitConfig(InputStream is, ServerCaller serverCaller) {
super(is, serverCaller);
configFile = YamlConfiguration.loadConfiguration(is);
}
代码示例来源:origin: sgtcaze/NametagEdit
public static YamlConfiguration getConfig(File file) {
try {
if (!file.exists()) {
file.createNewFile();
}
} catch (IOException e) {
e.printStackTrace();
}
return YamlConfiguration.loadConfiguration(file);
}
代码示例来源:origin: DRE2N/DungeonsXL
/**
* @param plugin the plugin instance
* @param file the script file
*/
public Announcer(DungeonsXL plugin, File file) {
this(plugin, file.getName().substring(0, file.getName().length() - 4), YamlConfiguration.loadConfiguration(file));
}
代码示例来源:origin: DRE2N/DungeonsXL
/**
* @param file the script file
*/
public SignScript(File file) {
this(file.getName().substring(0, file.getName().length() - 4), YamlConfiguration.loadConfiguration(file));
}
代码示例来源:origin: DRE2N/DungeonsXL
/**
* @param plugin the plugin instance
* @param file the script file
*/
public DMobType(DungeonsXL plugin, File file) {
this(plugin, file.getName().substring(0, file.getName().length() - 4), YamlConfiguration.loadConfiguration(file));
}
代码示例来源:origin: elBukkit/MagicPlugin
@Nullable
protected ConfigurationSection loadDataFile(String fileName) {
File dataFile = getDataFile(fileName);
if (!dataFile.exists()) {
return null;
}
Configuration configuration = YamlConfiguration.loadConfiguration(dataFile);
return configuration;
}
代码示例来源:origin: me.lucko/helper
@Nonnull
@Override
public YamlConfiguration loadConfig(@Nonnull String file) {
Objects.requireNonNull(file, "file");
return YamlConfiguration.loadConfiguration(getBundledFile(file));
}
代码示例来源:origin: DRE2N/DungeonsXL
/**
* @param file the file to save the protection to
*/
public void save(File file) {
save(YamlConfiguration.loadConfiguration(file));
}
代码示例来源:origin: DRE2N/DungeonsXL
/**
* @param file the file to save all protections to
*/
public void saveAll(File file) {
saveAll(YamlConfiguration.loadConfiguration(file));
}
代码示例来源:origin: Bkm016/TabooLib
public void reload(String name) {
File langFile = new File(getLanguageDir(), name + ".yml");
if (!langFile.exists()) {
MsgUtils.warn("语言文件 " + langName + " 不存在, 请更改配置文件");
return;
}
conf = YamlConfiguration.loadConfiguration(langFile);
}
代码示例来源:origin: Bkm016/TabooLib
public void reloadUTF8(String name) {
File langFile = new File(getLanguageDir(), name + ".yml");
if (!langFile.exists()) {
MsgUtils.warn("语言文件 " + langName + " 不存在, 请更改配置文件");
return;
}
try {
conf = YamlConfiguration.loadConfiguration(new InputStreamReader(new FileInputStream(langFile), Charsets.UTF_8));
} catch (FileNotFoundException e) {
conf = new YamlConfiguration();
}
}
代码示例来源:origin: mcMMO-Dev/mcMMO
/**
* Load formula file.
*/
public void loadFormula() {
if (!formulaFile.exists()) {
previousFormula = FormulaType.UNKNOWN;
return;
}
previousFormula = FormulaType.getFormulaType(YamlConfiguration.loadConfiguration(formulaFile).getString("Previous_Formula", "UNKNOWN"));
}
代码示例来源:origin: filoghost/HolographicDisplays
public static void loadYamlFile(Plugin plugin) {
file = new File(plugin.getDataFolder(), "database.yml");
if (!file.exists()) {
plugin.getDataFolder().mkdirs();
plugin.saveResource("database.yml", true);
}
config = YamlConfiguration.loadConfiguration(file);
}
代码示例来源:origin: Bkm016/TabooLib
public static void reloadItemDir() {
File file = new File(Main.getInst().getConfig().getString("DATAURL.ITEMDIR"));
if (file.exists()) {
itemDir = YamlConfiguration.loadConfiguration(file);
}
}
代码示例来源:origin: dzikoysk/WildSkript
private static void loadConfig() {
loadDefaultFiles(new String[]{ "config.yml" });
YamlConfiguration yaml = YamlConfiguration.loadConfiguration(CFG);
doc = yaml.getBoolean("doc");
mcstats = yaml.getBoolean("mcstats-enable");
debug = yaml.getBoolean("debug");
WildSkript.debug = debug;
}
代码示例来源:origin: mcMMO-Dev/mcMMO
public void load() {
InputStreamReader reader = mcMMO.p.getResourceAsReader(fileName);
if (reader != null) {
config = YamlConfiguration.loadConfiguration(reader);
chunkletsEnabled = config.getBoolean("Options.Chunklets", true);
conversionRate = config.getInt("Options.ConversionRate", 1);
useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true);
uuidConvertAmount = config.getInt("Options.UUIDConvertAmount", 5);
mojangRateLimit = config.getInt("Options.MojangRateLimit", 50000);
mojangLimitPeriod = config.getLong("Options.MojangLimitPeriod", 600000);
}
}
内容来源于网络,如有侵权,请联系作者删除!