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


Java FileConfiguration.getLong方法代码示例

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


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

示例2: BanRequest

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public BanRequest(int _id) {
	id = _id;
	FileConfiguration c = Main.getInstance().getConfig();
	timeOpened = c.getLong("ban_requests." + id + ".timeOpened");
	timeClosed = c.getLong("ban_requests." + id + ".timeClosed");
	openerUUID = c.getString("ban_requests." + id + ".openerUUID");
	closerUUID = c.getString("ban_requests." + id + ".closerUUID");
	timeOpenedFormatted = c.getString("ban_requests." + id + ".timeOpenedFormatted");
	timeClosedFormatted = c.getString("ban_requests." + id + ".timeClosedFormatted");
	closed = c.getBoolean("ban_requests." + id + ".closed");
	accepted = c.getBoolean("ban_requests." + id + ".accepted");
	denied = c.getBoolean("ban_requests." + id + ".denied");
	banReason = c.getString("ban_requests." + id + ".banReason");
	playerToBanUUID = c.getString("ban_requests." + id + ".playerToBanUUID");
}
 
开发者ID:JustBru00,项目名称:EpicBanRequests,代码行数:16,代码来源:BanRequest.java

示例3: DragonDeathRunnable

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
/**
 * Construct a new DragonDeathRunnable object
 * 
 * @param plugin an instance of the DragonEggDrop plugin
 * @param worldWrapper the world in which the dragon death is taking place
 * @param dragon the dragon dying in this runnable
 */
public DragonDeathRunnable(DragonEggDrop plugin, EndWorldWrapper worldWrapper, EnderDragon dragon) {
	this.plugin = plugin;
	this.worldWrapper = worldWrapper;
	this.world = worldWrapper.getWorld();
	this.dragon = dragon;
	
	FileConfiguration config = plugin.getConfig();
	this.particleType = Particle.valueOf(config.getString("Particles.type", "FLAME").toUpperCase());
	this.particleAmount = config.getInt("Particles.amount", 4);
	this.particleExtra = config.getDouble("Particles.extra", 0.0D);
	this.particleMultiplier = config.getDouble("Particles.speed-multiplier", 0.0D);
	this.particleStreamInterval = 360 / Math.max(1, config.getInt("Particles.stream-count"));
	this.xOffset = config.getDouble("Particles.xOffset");
	this.yOffset = config.getDouble("Particles.yOffset");
	this.zOffset = config.getDouble("Particles.zOffset");
	this.particleInterval = config.getLong("Particles.interval", 1L);
	this.lightningAmount = config.getInt("lightning-amount");
	
	// Portal location
	DragonBattle dragonBattle = plugin.getNMSAbstract().getEnderDragonBattleFromDragon(dragon);
	Location portalLocation = dragonBattle.getEndPortalLocation();
	this.currentY = config.getDouble("Particles.egg-start-y");
	this.location = new Location(world, portalLocation.getX(), this.currentY, portalLocation.getZ());
	
	// Expression parsing
	String shape = config.getString("Particles.Advanced.preset-shape");
	String xCoordExpressionString = config.getString("Particles.Advanced.x-coord-expression");
	String zCoordExpressionString = config.getString("Particles.Advanced.z-coord-expression");
	
	if (shape.equalsIgnoreCase("BALL")) {
		this.particleShape = new ParticleShapeDefinition(location, "x", "z");
	}
	else if (shape.equalsIgnoreCase("HELIX")) {
		this.particleShape = new ParticleShapeDefinition(location, "cos(theta) * 1.2", "sin(theta) * 1.2");
	}
	else if (shape.equalsIgnoreCase("OPEN_END_HELIX")) {
		this.particleShape = new ParticleShapeDefinition(location, "cos(theta) * (100 / t)", "sin(theta) * (100 / t)");
	}
	else { // CUSTOM or default
		this.particleShape = new ParticleShapeDefinition(location, xCoordExpressionString, zCoordExpressionString);
	}

	this.respawnDragon = config.getBoolean("respawn-on-death", false);
	this.runTaskTimer(plugin, 0, this.particleInterval);
	
	BattleStateChangeEvent bscEventCrystals = new BattleStateChangeEvent(dragonBattle, dragon, BattleState.BATTLE_END, BattleState.PARTICLES_START);
	Bukkit.getPluginManager().callEvent(bscEventCrystals);
}
 
开发者ID:2008Choco,项目名称:DragonEggDrop,代码行数:56,代码来源:DragonDeathRunnable.java


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