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