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