當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。