本文整理匯總了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);
}
}
示例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();
}
示例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()));
}
}
示例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();
}