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


Java YamlConfiguration.getConfigurationSection方法代码示例

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


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

示例1: Menu

import org.bukkit.configuration.file.YamlConfiguration; //导入方法依赖的package包/类
public Menu(MessageManager messageManager, YamlConfiguration section) {
	ConfigurationSection settings = section.getConfigurationSection(Node.SETTINGS.get());
	if(settings == null){
		Error.MISSING_NODE.add(Node.SETTINGS.get());
		title = new MComponent(VanillaPlusCore.getDefaultLang(), " ");
		icons = new Icon[37];
		type = InventoryType.CHEST;
		refresh = 0;
		return;
	}else{
		title = messageManager.getComponentManager().get(settings.getString(Node.NAME_PATH.get()));
		type = InventoryType.valueOf(settings.getString(Node.TYPE.get(), "CHEST"));
		if(type == InventoryType.CHEST) {
			int size = settings.getInt("ROWS");
			if(size < 0 || size > 12)
				ErrorLogger.addError("ROWS must be between 0 and 12 inclulsive !");
			icons = new Icon[9*size+1];
		}
		else
			icons = new Icon[type.getDefaultSize()+1];
		refresh = (byte) settings.getInt("REFRESH", 0);
		
	}
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:25,代码来源:Menu.java

示例2: init

import org.bukkit.configuration.file.YamlConfiguration; //导入方法依赖的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

示例3: loadSupplyData

import org.bukkit.configuration.file.YamlConfiguration; //导入方法依赖的package包/类
public void loadSupplyData() {
	file = new PluginFile(main, "supplyDrops", FileType.YAML);
	YamlConfiguration config = file.returnYaml();

	// Supply content
	// If no content for supply drops is set in config, set a default one to
	// avoid a NPE.
	if (config.getConfigurationSection("supply-drops.items") == null) {
		main.getLogger().info("No Supplydrop content found. Setting defaults.");
		String path = "supply-drops.items.0";
		config.set(path + ".material", "STONE");
		config.set(path + ".chance", 75);
		config.set(path + ".amount", 32);
		file.save(config);
	}

	for (String key : config.getConfigurationSection("supply-drops.items").getKeys(false)) {

		Material itemMaterial = Material
				.valueOf(config.getString("supply-drops.items." + key + ".material").toUpperCase());
		int itemChance = config.getInt("supply-drops.items." + key + ".chance");
		int itemAmount = config.getInt("supply-drops.items." + key + ".amount");

		supplyContent.add(new SupplyDropContent(itemMaterial, itemChance, itemAmount));
	}

	// Supply drops
	for (String s : config.getStringList("supply-drops.objects")) {
		Location loc = StringUtilities.stringToLocation(s);

		loc.getBlock().setType(Material.CHEST);
		Chest chest = (Chest) loc.getBlock().getState();
		supplyDrops.add(new SupplyDropObject(loc, chest, chest.getInventory()));
	}
}
 
开发者ID:kadeska,项目名称:MT_Core,代码行数:36,代码来源:SupplyDropManager.java

示例4: init

import org.bukkit.configuration.file.YamlConfiguration; //导入方法依赖的package包/类
public void init(VanillaPlusCore core) {
	if(core == null)return;
	YamlConfiguration section = ConfigUtils.getYaml(core.getInstance(), "Icon", false);
	ErrorLogger.addPrefix("Icon.yml");
	ConfigurationSection settings = section.getConfigurationSection(Node.SETTINGS.get());
	if(settings != null){
		ErrorLogger.addPrefix(Node.SETTINGS.get());
		fillIcon = get(settings.getString(Node.FILL.get()), true);
		ErrorLogger.removePrefix();
	}
	ErrorLogger.removePrefix();
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:13,代码来源:IconManager.java


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