本文整理汇总了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);
}