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


Java ConfigurationSection.getConfigurationSection方法代码示例

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


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

示例1: getIndexTopics

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:21,代码来源:HelpYamlReader.java

示例2: initPost

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public void initPost(ConfigurationSection section, MComponentManager manager) {
	Object requirement = section.get(Node.REQUIREMENT.get());
	ErrorLogger.addPrefix(Node.REQUIREMENT.get());
	if(requirement!=null){
		this.requirement = new Requirement(requirement, manager);
	}else if (warn){
		ErrorLogger.addError("Free Achievement should be avoided !");
		warn = false;
	}
	ErrorLogger.removePrefix();
	ErrorLogger.addPrefix(Node.REWARD.get());
	ConfigurationSection reward = section.getConfigurationSection(Node.REWARD.get());
	if(reward!=null)
		this.reward = new Reward(reward, manager);
	ErrorLogger.removePrefix();
	
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:18,代码来源:Achievement.java

示例3: init

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public void init(VanillaPlusCore core) {
	ConfigurationSection section = ConfigUtils.getYaml(core.getInstance(), "Stat", false);
	ErrorLogger.addPrefix("Stat.yml");
	ConfigurationSection settings = section == null ? null : section.getConfigurationSection(Node.SETTINGS.get());
	ErrorLogger.addPrefix(Node.SETTINGS.get());
	if(settings==null){
		startDataBase(VanillaPlusCore.getIConnectionManager().get(null));
		
	}else{
		startDataBase(VanillaPlusCore.getIConnectionManager().get(settings.getString("STORAGE")));
	}
	ErrorLogger.removePrefix();
	if(!extensions.isEmpty()) {
		new BukkitRunnable() {
			
			@Override
			public void run() {
				for(VPPlayer player : VanillaPlusCore.getPlayerManager().getOnlinePlayers())
					update(player);
					
			}
		}.runTaskTimer(VanillaPlus.getInstance(), 20*60, 20*60);
	}
	ErrorLogger.removePrefix();
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:26,代码来源:StatManager.java

示例4: load

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public void load(File dataFolder, ConfigurationSection config) {
    Path localRepositoryDirectory = Paths.get(config.getString("local_repository_directory"));
    if (!localRepositoryDirectory.isAbsolute())
        localRepositoryDirectory = dataFolder.toPath().resolve(localRepositoryDirectory);
    setLocalRepositoryDirectory(localRepositoryDirectory.toFile());

    ConfigurationSection repositories = config.getConfigurationSection("repositories");
    if (repositories != null) {
        Map<String, Object> entries = repositories.getValues(false);
        List<RemoteRepository> resultRepositories = new ArrayList<>(entries.size());
        for (Map.Entry<String, Object> entry : entries.entrySet())
            resultRepositories.add(readRemoteRepository(entry.getKey(), (ConfigurationSection) entry.getValue()));
        setRepositories(resultRepositories);
    } else {
        setRepositories(Collections.emptyList());
    }
}
 
开发者ID:MCCityVille,项目名称:libmanager,代码行数:18,代码来源:Config.java

示例5: readRemoteRepository

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
private static RemoteRepository readRemoteRepository(String id, ConfigurationSection config) {
    String url = config.getString("url");
    RemoteRepository.Builder builder = new RemoteRepository.Builder(id, "default", url);

    ConfigurationSection authConfig = config.getConfigurationSection("authentication");
    if (authConfig != null)
        builder = builder.setAuthentication(readAuthentication(authConfig));

    ConfigurationSection releasePolicyConfig = config.getConfigurationSection("release_policy");
    if (releasePolicyConfig != null)
        builder = builder.setReleasePolicy(readRepositoryPolicy(releasePolicyConfig));

    ConfigurationSection snapshotPolicyConfig = config.getConfigurationSection("snapshot_policy");
    if (snapshotPolicyConfig != null)
        builder = builder.setSnapshotPolicy(readRepositoryPolicy(snapshotPolicyConfig));

    return builder.build();
}
 
开发者ID:MCCityVille,项目名称:libmanager,代码行数:19,代码来源:Config.java

示例6: init

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public static void init() {
    if (entityDistances != null) return;
    entityDistances = Maps.newHashMap();
    ConfigurationSection section = Bukkit.spigot().getConfig().getConfigurationSection("world-settings");
    ConfigurationSection defaultSec = section.getConfigurationSection("default.entity-tracking-range");
    for (String s : section.getKeys(false)) {
        ConfigurationSection world = section.getConfigurationSection(s + ".entity-tracking-range");
        int[] ranges = new int[]{
                world.contains("players") ? world.getInt("players") : defaultSec.getInt("players"),
                world.contains("animals") ? world.getInt("animals") : defaultSec.getInt("animals"),
                world.contains("monsters") ? world.getInt("monsters") : defaultSec.getInt("monsters"),
                world.contains("misc") ? world.getInt("misc") : defaultSec.getInt("misc"),
                world.contains("other") ? world.getInt("other") : defaultSec.getInt("other")
        };
        int max = 0;
        for (int range : ranges) {
            if (range > max) max = range;
        }
        entityDistances.putIfAbsent(s, max);
    }
}
 
开发者ID:iso2013,项目名称:MultiLineAPI,代码行数:22,代码来源:EntityUtil.java

示例7: init

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public void init(VanillaPlusCore core) {
	if(core == null)return;
	ConfigurationSection section = ConfigUtils.getYaml(core.getInstance(), "Versus", false);
	if(section == null)return;
	ErrorLogger.addPrefix("Versus.yml");
	ConfigurationSection settings = section.getConfigurationSection(Node.SETTINGS.get());
	ErrorLogger.addPrefix(Node.SETTINGS.get());
	if(settings == null){
		Error.INVALID.add();
	}else{
		ipvpDefault		= core.getMessageManager().get(settings.getString("IPVP_DEFAULT"));
		pveDefault		= core.getMessageManager().get(settings.getString("PVE_DEFAULT"));
		pvpDefault		= core.getMessageManager().get(settings.getString("PVP_DEFAULT"));
		offlineDeath	= core.getMessageManager().get(settings.getString("OFFLINE_DEATH"));
		log				= settings.getBoolean("LOG", false);
		respawn = RespawnType.valueOf(settings.getString("RESPAWN_TYPE", "SPEC"));
	}
	ErrorLogger.removePrefix();
	ErrorLogger.removePrefix();
	
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:22,代码来源:VersusManager.java

示例8: 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

示例9: init

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public void init(VanillaPlusCore core) {
	ConfigurationSection section = ConfigUtils.getYaml(core.getInstance(), "Requirement", false);
	ErrorLogger.addPrefix("Requirement.yml");
	ConfigurationSection settings = section == null ? null : section.getConfigurationSection(Node.SETTINGS.get());
	if(settings!=null && own == null) {
		ErrorLogger.addPrefix(Node.SETTINGS.get());
		own							= core.getMessageCManager().get(settings.getString("OWN"));
		lack						= core.getMessageCManager().get(settings.getString("LACK"));
		RequirementPermission.init(	core.getMessageCManager().get(settings.getString("PERMISSION")));
		Requirement.setAnd(			core.getMessageCManager().get(settings.getString("AND")));
		Requirement.setNot(			core.getMessageCManager().get(settings.getString("NOT")));
		Requirement.setOr(			core.getMessageCManager().get(settings.getString("OR")));
		ErrorLogger.removePrefix();
	} else if ( own == null ) {
		own = lack = core.getMessageCManager().get(null);
		Error.MISSING_NODE.add(Node.SETTINGS.get());
	}
	ErrorLogger.removePrefix();
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:20,代码来源:IRequirementManager.java

示例10: init

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public void init(VanillaPlusExtension extension) {
	if(extension == null)
		return;
	YamlConfiguration section = ConfigUtils.getYaml(extension.getInstance(), "Title", false);
	if(section == null)return;
	ErrorLogger.addPrefix("Title.yml");
	ConfigurationSection titleSub = section.getConfigurationSection(Node.TITLE.getList());
	if(titleSub != null){
		ErrorLogger.addPrefix(Node.TITLE.getList());
		for(String key : titleSub.getKeys(false)){
			ConfigurationSection sub = titleSub.getConfigurationSection(key);
			if(sub == null)
				continue;
			int id = Utils.parseInt(key, 0, true);
			if( id <= 0 || id > Short.MAX_VALUE)
				continue;
			if(id>bigger)
				bigger = id;
			Title title = new Title(id, sub, extension.getMessageCManager());
			titles.put(title.getID(), title);
		}
		ErrorLogger.removePrefix();
	}
	ErrorLogger.removePrefix();
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:26,代码来源:TitleManager.java

示例11: init

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public void init(VanillaPlusExtension extension) {
	ConfigurationSection section = ConfigUtils.getYaml(extension.getInstance(), "Channel", false);
	if(section == null)return;
	ErrorLogger.addPrefix("Channel.yml");
	ErrorLogger.addPrefix(Node.CHANNEL.getList());
	ConfigurationSection list = section.getConfigurationSection(Node.CHANNEL.getList()); 
	if(list == null)
		Error.INVALID.add();
	else
		super.init(list, extension.getMessageManager());
	ErrorLogger.removePrefix();
	ErrorLogger.removePrefix();
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:14,代码来源:ChannelManager.java

示例12: getGeneralTopics

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
/**
 * Extracts a list of all general help topics from help.yml
 *
 * @return A list of general topics.
 */
public List<HelpTopic> getGeneralTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection generalTopics = helpYaml.getConfigurationSection("general-topics");
    if (generalTopics != null) {
        for (String topicName : generalTopics.getKeys(false)) {
            ConfigurationSection section = generalTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String fullText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("fullText", ""));
            String permission = section.getString("permission", "");
            topics.add(new CustomHelpTopic(topicName, shortText, fullText, permission));
        }
    }
    return topics;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:20,代码来源:HelpYamlReader.java

示例13: init

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public void init(VanillaPlusCore core) {
	if(core == null)return;
	ConfigurationSection section = ConfigUtils.getYaml(core.getInstance(), "Command", false);
	if(section == null)return;
	ErrorLogger.addPrefix("Command.yml");
	ConfigurationSection temp = section.getConfigurationSection(Node.SETTINGS.get());
	ErrorLogger.addPrefix(Node.SETTINGS.get());
	if(temp == null){
		Error.MISSING.add();
    	topHelp			= core.getMessageManager().get(null);
    	commandHelp		= core.getMessageManager().get(null);
    	noRequirement	= core.getMessageManager().get(null);
   		ErrorLogger.removePrefix();
		return;
	}else{
    	topHelp			= core.getMessageManager().get(temp.getString("TOP_HELP"));
    	commandHelp		= core.getMessageManager().get(temp.getString("HELP"));
    	noRequirement	= core.getMessageManager().get(temp.getString(Node.NO_REQUIREMENT.get()));
    	List<String>toRemove = temp.getStringList("TO_REMOVE");
    	if(toRemove != null && !toRemove.isEmpty()){
    		for(String s : toRemove)
    			commandMap.remove(s);
    	}
	}
   	for(CommandPlus cmd : getLoaded()){
   		register(cmd);
   	}
   	commandMap.put(PlaceH.HELP.get(), new LinkCommand(PlaceH.HELP.get(), PlaceH.HELP.get(),
			"/"+PlaceH.HELP.get()+" [page]", Arrays.asList(PlaceH.HELP.get()), null));
	ErrorLogger.removePrefix();
	ErrorLogger.removePrefix();
	
	
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:35,代码来源:CPManager.java

示例14: 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

示例15: CustomItem

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
CustomItem(String id, ConfigurationSection config) {
    super(config, config.getString("texture"));

    Rarity rarity = Rarity.valueOf(config.getString("rarity"));
    this.name = StringUtils.coloredLine(rarity.getColor() + config.getString("name"));

    if (config.contains("stats")) {
        for (String stat : config.getStringList("stats")) {
            this.stats.add(new ItemStat(ItemStat.StatType.valueOf(stat.split(" ")[0]), stat.split(" ")[1]));
        }
    }

    this.lore = config.contains("lore") ? StringUtils.coloredLines(config.getStringList("lore")) : null;

    this.leftClickAction = config.contains("abilities.left-click.command")
            ? new ItemAction(config.getConfigurationSection("abilities.left-click"))
            : null;
    this.rightClickAction = config.contains("abilities.right-click.command")
            ? new ItemAction(config.getConfigurationSection("abilities.right-click"))
            : null;

    this.permissions = config.contains("abilities.permissions") ? config.getStringList("abilities.permissions") : null;
    this.drop = config.getBoolean("drop", true);
    this.unbreakable = config.getBoolean("unbreakable", false);
    this.statsHidden = config.getBoolean("hide-stats", false);

    this.createItem(id);
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:29,代码来源:CustomItem.java


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