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


Java ConfigurationSection.isConfigurationSection方法代码示例

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


在下文中一共展示了ConfigurationSection.isConfigurationSection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupConfiguration

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
private void setupConfiguration(final ConfigurationSection section) {
    if (section.isConfigurationSection("worlds")) {
        final ConfigurationSection wSection = section
                .getConfigurationSection("worlds");

        for (String wName : wSection.getKeys(false)) {
            final int centerX = wSection.getInt(wName + ".centerX", 0);
            final int centerZ = wSection.getInt(wName + ".centerZ", 0);
            final int distance = wSection.getInt(
                    wName + ".distance", DEFAULT_DISTANCE);
            final double knockback = wSection.getDouble(
                    wName + ".knockback-distance", DEFAULT_KNOCKBACK);

            WorldBorder wb = new BasicWorldBorder(
                    centerX, centerZ, distance);
            wb.setKnockbackDistance(knockback);
            this.worldBorders.put(wName, wb);

            this.plugin.getLogger().log(Level.INFO, "Created border"
                    + " for world '" + wName + "'!" + lineSeparator()
                    + "Knockback=" + knockback + lineSeparator()
                    + "Distance = " + distance
            );
        }
    }
}
 
开发者ID:Mystiflow,项目名称:WorldBorder,代码行数:27,代码来源:BasicWorldBorderHandler.java

示例2: getItem

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public ItemStack getItem(ConfigurationSection section, String key, Supplier<ItemStack> def) throws InvalidConfigurationException {
    if(section.isString(key)) {
        return new ItemStack(needItemType(section, key));
    }

    if(!section.isConfigurationSection(key)) {
        return def.get();
    }

    final ConfigurationSection itemSection = section.needSection(key);

    if(itemSection.isString("skull")) {
        return needSkull(itemSection, "skull");
    }

    final Material material = needItemType(itemSection, "id");

    final int damage = itemSection.getInt("damage", 0);
    if(damage < Short.MIN_VALUE || damage > Short.MAX_VALUE) {
        throw new InvalidConfigurationException(itemSection, "damage", "Item damage out of range");
    }

    final ItemStack stack = new ItemStack(material, 1, (short) damage);

    if(itemSection.isString("skin")) {
        needSkull(stack, itemSection, "skin");
    }

    return stack;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:31,代码来源:ItemConfigurationParser.java

示例3: loadLanguageSection

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
/**
 * add all language items from section into language map recursively
 * overwrite existing items
 * The '&' will be transformed to color code.
 *
 * @param section        source section
 * @param prefix         used in recursion to determine the proper prefix
 * @param ignoreInternal ignore keys prefixed with `internal'
 * @param ignoreNormal   ignore keys not prefixed with `internal'
 */
private static void loadLanguageSection(Map<String, String> map, ConfigurationSection section, String prefix, boolean ignoreInternal, boolean ignoreNormal) {
    if (map == null || section == null || prefix == null) return;
    for (String key : section.getKeys(false)) {
        String path = prefix + key;
        if (section.isString(key)) {
            if (path.startsWith("internal") && ignoreInternal) continue;
            if (!path.startsWith("internal") && ignoreNormal) continue;
            map.put(path, ChatColor.translateAlternateColorCodes('&', section.getString(key)));
        } else if (section.isConfigurationSection(key)) {
            loadLanguageSection(map, section.getConfigurationSection(key), path + ".", ignoreInternal, ignoreNormal);
        }
    }
}
 
开发者ID:Librazy,项目名称:NyaaUtilsLangChecker,代码行数:24,代码来源:NyaaUtilsLangAnnotationProcessor.java

示例4: removeUnusedValues

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
private void removeUnusedValues(ConfigurationSection cs) {
	Map<String, Object> objs = cs.getValues(false);
	for (String key : objs.keySet()) {
		if (cs.isConfigurationSection(key)) {
			removeUnusedValues(cs.getConfigurationSection(key));
			if (cs.getConfigurationSection(key) == null || cs.getConfigurationSection(key).getValues(false).isEmpty()) {
				cs.set(key, null);
			}
		} else if (!defaultValues.containsKey(cs.getCurrentPath() + (cs.getCurrentPath().isEmpty() ? "" : ".") + key)) {
			cs.set(key, null);
		}
	}
}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:14,代码来源:Conf.java

示例5: deserialize

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
@Override
public void deserialize(ConfigurationSection config) {
    playerSpawn.clear();
    ISerializable.deserialize(config, this);
    if (config.isConfigurationSection("spawn")) {
        ConfigurationSection cfg = config.getConfigurationSection("spawn");
        for (String uuid : cfg.getKeys(false)) {
            playerSpawn.put(UUID.fromString(uuid), cfg.getString(uuid));
        }
    }
}
 
开发者ID:NyaaCat,项目名称:Ourtown,代码行数:12,代码来源:PlayerConfig.java


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