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