本文整理汇总了Java中ninja.leaping.configurate.ConfigurationNode.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationNode.getDouble方法的具体用法?Java ConfigurationNode.getDouble怎么用?Java ConfigurationNode.getDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ninja.leaping.configurate.ConfigurationNode
的用法示例。
在下文中一共展示了ConfigurationNode.getDouble方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseLocation
import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
public static Location<World> parseLocation(ConfigurationNode node) {
ConfigurationNode x_node = node.getNode("X");
ConfigurationNode y_node = node.getNode("Y");
ConfigurationNode z_node = node.getNode("Z");
ConfigurationNode world_node = node.getNode("WORLD_NAME");
if (x_node.isVirtual()) {
throw new RuntimeException("X node does not exist!");
}
if (y_node.isVirtual()) {
throw new RuntimeException("Y node does not exist!");
}
if (z_node.isVirtual()) {
throw new RuntimeException("Z node does not exist!");
}
if (world_node.isVirtual()) {
throw new RuntimeException("WORLD_NAME node does not exist!");
}
double x = x_node.getDouble();
double y = y_node.getDouble();
double z = z_node.getDouble();
String world_name = world_node.getString();
Optional<World> optional_world = Sponge.getServer().getWorld(world_name);
if (!optional_world.isPresent()) {
throw new RuntimeException("World \"" + world_name + "\" does not exist!");
}
World world = optional_world.get();
return new Location<World>(world, x, y, z);
}
示例2: getFactionPower
import ninja.leaping.configurate.ConfigurationNode; //导入方法依赖的package包/类
public static BigDecimal getFactionPower(Faction faction)
{
if(faction.Name.equals("SafeZone") || faction.Name.equals("WarZone"))
{
ConfigurationNode powerNode = ConfigAccess.getConfig(factionsConfig).getNode("factions", faction.Name, "power");
BigDecimal factionPowerInFile = new BigDecimal(powerNode.getDouble());
return factionPowerInFile;
}
BigDecimal factionPower = BigDecimal.ZERO;
if(faction.Leader != null && faction.Leader != "")
{
factionPower = factionPower.add(getPlayerPower(UUID.fromString(faction.Leader)));
}
if(faction.Officers != null && !faction.Officers.isEmpty())
{
for (String officer: faction.Officers)
{
BigDecimal officerPower = getPlayerPower(UUID.fromString(officer));
factionPower =factionPower.add(officerPower);
}
}
if(faction.Members != null && !faction.Members.isEmpty())
{
for (String member: faction.Members)
{
BigDecimal memberPower = getPlayerPower(UUID.fromString(member));
factionPower = factionPower.add(memberPower);
}
}
return factionPower;
}