當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。