gpt4 book ai didi

com.sk89q.util.yaml.YAMLNode.getNode()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 01:35:31 25 4
gpt4 key购买 nike

本文整理了Java中com.sk89q.util.yaml.YAMLNode.getNode()方法的一些代码示例,展示了YAMLNode.getNode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YAMLNode.getNode()方法的具体详情如下:
包路径:com.sk89q.util.yaml.YAMLNode
类名称:YAMLNode
方法名:getNode

YAMLNode.getNode介绍

[英]Get a configuration node at a path. If the node doesn't exist or the path does not lead to a node, null will be returned. A node has key/value mappings.
[中]在路径上获取配置节点。如果节点不存在或路径不指向节点,将返回null。节点具有键/值映射。

代码示例

代码示例来源:origin: EngineHub/WorldEdit

/**
 * Gets a 2D vector at a location. This will either return an Vector
 * or a null. If the object at the particular location is not
 * actually a string, it will be converted to its string representation.
 * 
 * @param path path to node (dot notation)
 * @return string or default
 */
public Vector2 getVector2(String path) {
  YAMLNode o = getNode(path);
  if (o == null) {
    return null;
  }
  Double x = o.getDouble("x");
  Double z = o.getDouble("z");
  if (x == null || z == null) {
    return null;
  }
  return Vector2.at(x, z);
}

代码示例来源:origin: EngineHub/WorldEdit

/**
 * Gets a vector at a location. This will either return an Vector
 * or a null. If the object at the particular location is not
 * actually a string, it will be converted to its string representation.
 * 
 * @param path path to node (dot notation)
 * @return string or default
 */
public Vector3 getVector(String path) {
  YAMLNode o = getNode(path);
  if (o == null) {
    return null;
  }
  Double x = o.getDouble("x");
  Double y = o.getDouble("y");
  Double z = o.getDouble("z");
  if (x == null || y == null || z == null) {
    return null;
  }
  return Vector3.at(x, y, z);
}

代码示例来源:origin: EngineHub/WorldGuard

setFlags(flagRegistry, region, node.getNode("flags"));
region.setOwners(parseDomain(node.getNode("owners")));
region.setMembers(parseDomain(node.getNode("members")));

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com