当前位置: 首页>>代码示例>>Java>>正文


Java FileConfiguration.isConfigurationSection方法代码示例

本文整理汇总了Java中org.bukkit.configuration.file.FileConfiguration.isConfigurationSection方法的典型用法代码示例。如果您正苦于以下问题:Java FileConfiguration.isConfigurationSection方法的具体用法?Java FileConfiguration.isConfigurationSection怎么用?Java FileConfiguration.isConfigurationSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.configuration.file.FileConfiguration的用法示例。


在下文中一共展示了FileConfiguration.isConfigurationSection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: storeNewData

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void storeNewData(Learn learn, KnownCheating knownCheating) {
	final FileConfiguration fc = getConfig();

	// Generate a UUID for this check (its identifier).
	UUID uuid = UUID.randomUUID();

	while (fc.isConfigurationSection(uuid.toString())) {
		uuid = UUID.randomUUID();
	}

	// The path to put the data in the file.
	String cheatPath = getCheatPath(knownCheating);

	// Get general values.
	final double currentMean = fc.getDouble(cheatPath + "CurrentMean");
	final double currentLowRange = fc.getDouble(cheatPath + "CurrentLowRange");
	final double currentHighRange = fc.getDouble(cheatPath + "CurrentHighRange");
	final long totalSamples = fc.getLong(cheatPath + "TotalSamples");

	if (currentLowRange == 0.0 || learn.getValue() < currentLowRange) {
		fc.set(cheatPath + "CurrentLowRange", learn.getValue());
	} else if (learn.getValue() > currentHighRange) {
		fc.set(cheatPath + "CurrentHighRange", learn.getValue());
	}

	// Calculate the new average.
	double updateMean = (currentMean + learn.getValue()) / 2.0;

	fc.set(cheatPath + "CurrentMean", updateMean);
	fc.set(cheatPath + "TotalSamples", totalSamples + 1);

	// Save the file.
	save(fc);
}
 
开发者ID:davidm98,项目名称:Crescent,代码行数:35,代码来源:LearnData.java


注:本文中的org.bukkit.configuration.file.FileConfiguration.isConfigurationSection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。