本文整理了Java中org.bukkit.plugin.Plugin.saveConfig()
方法的一些代码示例,展示了Plugin.saveConfig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.saveConfig()
方法的具体详情如下:
包路径:org.bukkit.plugin.Plugin
类名称:Plugin
方法名:saveConfig
[英]Saves the FileConfiguration retrievable by #getConfig().
[中]保存可通过#getConfig()检索的文件配置。
代码示例来源:origin: aadnk/ProtocolLib
/**
* Save the current configuration file.
*/
public void saveAll() {
if (valuesChanged)
saveLastUpdate(lastUpdateTime);
if (configChanged)
plugin.saveConfig();
// And we're done
valuesChanged = false;
configChanged = false;
}
}
代码示例来源:origin: garbagemule/MobArena
private static void process(Plugin plugin, String resource, ConfigurationSection section, boolean addOnlyIfEmpty, boolean removeObsolete) {
YamlConfiguration defaults = resourceCache.computeIfAbsent(resource, res -> {
InputStream is = plugin.getResource("res/" + res);
if (is == null) {
throw new IllegalStateException("Couldn't read " + res + " from jar, please re-install MobArena");
}
Scanner scanner = new Scanner(is).useDelimiter("\\A");
if (!scanner.hasNext()) {
throw new IllegalStateException("No content in " + res + " in jar, please re-install MobArena");
}
String contents = scanner.next();
YamlConfiguration yaml = new YamlConfiguration();
try {
yaml.loadFromString(contents);
return yaml;
} catch (InvalidConfigurationException e) {
throw new IllegalStateException("Invalid contents in " + res + " in jar, please re-install MobArena", e);
}
});
boolean modified = process(defaults, section, addOnlyIfEmpty, removeObsolete);
if (modified) {
plugin.saveConfig();
}
}
代码示例来源:origin: com.github.drepic26/couponcodes
public BukkitConfigHandler(Plugin plugin) {
this.config = plugin.getConfig();
if (!(new File("plugins/CouponCodes/config.yml").exists()))
plugin.saveDefaultConfig();
if (!config.options().copyDefaults(true).configuration().equals(config))
plugin.saveConfig();
}
代码示例来源:origin: garbagemule/MobArena
private void loadLimitMap(Plugin plugin) {
// If the config-section is empty, create and populate it.
if (limits.getKeys(false).isEmpty()) {
for (ArenaClass ac : classes.values()) {
limits.set(ac.getConfigName(), -1);
}
plugin.saveConfig();
}
// Populate the limits map using the values in the config-file.
for (ArenaClass ac : classes.values()) {
classLimits.put(ac, new MutableInt(limits.getInt(ac.getConfigName(), -1)));
}
}
代码示例来源:origin: eccentricdevotion/TARDIS
if (twa != null) {
twa.getConfig().set("daleks.worlds.Skaro", 500);
twa.saveConfig();
内容来源于网络,如有侵权,请联系作者删除!