當前位置: 首頁>>代碼示例>>Java>>正文


Java YamlConfiguration.getStringList方法代碼示例

本文整理匯總了Java中org.bukkit.configuration.file.YamlConfiguration.getStringList方法的典型用法代碼示例。如果您正苦於以下問題:Java YamlConfiguration.getStringList方法的具體用法?Java YamlConfiguration.getStringList怎麽用?Java YamlConfiguration.getStringList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.configuration.file.YamlConfiguration的用法示例。


在下文中一共展示了YamlConfiguration.getStringList方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: load

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public static FireCraftTableRecipe load(String name){
	 File f=new File(rs.getDataFolder()+File.separator+"SyntheticFormula"+File.separator+"FireCraftTable"+File.separator+name+".yml");
	 if(!f.exists())return null;
	 YamlConfiguration recipe=YamlConfiguration.loadConfiguration(f);
	 HashMap<Character,ItemStack> materials=new HashMap<>();
	 char c=' ';
	 for(String s:recipe.getStringList(name+".shape"))
		 for(char temp:s.toCharArray())
			 if(temp!=' '&&temp!=c){
				 c=temp;
				 materials.put(c, recipe.getItemStack(name+".material."+c));
			 }
	 ItemStack[] product=new ItemStack[4];
	 for(int i=0;i<3;i++)
		 product[i]=recipe.getItemStack(name+".product."+i);
	 
	 return new FireCraftTableRecipe(recipe.getInt(name+".time"),recipe.getDouble(name+".temperature"),recipe.getInt(name+".maxTime"), name,
			 recipe.getStringList(name+".shape"), materials, product);
}
 
開發者ID:SchoolUniform,項目名稱:RealSurvival,代碼行數:20,代碼來源:FireCraftTableRecipe.java

示例2: getPlayerData

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
/**
 * ��ȡPlayerData
 * @param rs ����·��
 * @param p Player����
 * @return PlayerData����
 */
public static PlayerData getPlayerData(Player p){
	File data=new File(rs.getDataFolder()+File.separator+"PlayerDatas"+File.separator+p.getUniqueId().toString()+".yml");
	PlayerData pd;
	if(!data.exists()){
		try {data.createNewFile();} catch (IOException e) {}
		pd=new PlayerData(p.getUniqueId(),p.getWorld().getName(), rs.getSleepMax(), 
											rs.getThirstMax(), 0, 37,0, rs.getPhysical_strength());
		return pd;
	}
	YamlConfiguration dataC=YamlConfiguration.loadConfiguration(data);
	HashMap<String,Object[]> sickKind=new HashMap<String,Object[]>();
	for(String temp:dataC.getStringList("rSickKind")){
		List<String> l=dataC.getStringList("sickKind."+temp);
		sickKind.put(temp,new Object[]{l.get(0),l.get(1),l.get(2),l.get(3)} );
	}
	pd=new PlayerData( p.getUniqueId(),dataC.getString("world"), dataC.getDouble("sleep"),
			dataC.getDouble("thirst"), dataC.getDouble("temperature"), dataC.getDouble("weight"), 
			dataC.getDouble("physical_strength"),dataC.getBoolean("sick"), 
			dataC.getBoolean("isSleep"),Byte.parseByte(dataC.getString("light")),sickKind);
	return pd;
}
 
開發者ID:SchoolUniform,項目名稱:RealSurvival,代碼行數:28,代碼來源:Utils.java

示例3: loadData

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public void loadData() {
	file = new PluginFile(main, "data", FileType.YAML);
	YamlConfiguration config = file.returnYaml();
	
	checkDefaults();
	
	// Supplydrops related.
	for (String worldString : config.getStringList("supply-drops.enabled-worlds")) {
		supplyDropWorlds.add(Bukkit.getWorld(worldString));
	}
	
	// Radiation related.
	this.defaultRadiationDamage = config.getDouble("radiation.default-damage");
	this.stormRadiationDamage = config.getDouble("radiation.storm-damage");
	this.waterRadiationDamage = config.getDouble("radiation.water-damage");
	this.radiationDamageDelay = config.getInt("radiation.seconds-delay");
}
 
開發者ID:kadeska,項目名稱:MT_Core,代碼行數:18,代碼來源:DataManager.java

示例4: checkDefaults

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
/**
 * Checks if any configuration sections is null and sets a default
 * to avoid a NPE.
 */
private void checkDefaults() {
	YamlConfiguration config = file.returnYaml();
	main.getLogger().info("Checking for defaults inside data.yml");
	
	if (config.getStringList("supply-drops.enabled-worlds") == null || config.getStringList("supply-drops.enabled-worlds").isEmpty()) {
		config.set("supply-drops.enabled-worlds", Arrays.asList("world"));
	}
	
	if (config.get("radiation.default-damage") == null)
		config.set("radiation.default-damage", 1D);
	
	if (config.get("radiation.storm-damage") == null)
		config.set("radiation.storm-damage", 1D);
	
	if (config.get("radiation.water-damage") == null)
		config.set("radiation.water-damage", 2D);
	
	if (config.get("radiation.seconds-delay") == null)
		config.set("radiation.seconds-delay", 3);
	
	file.save(config);
	main.getLogger().info("Saved defaults.");
}
 
開發者ID:kadeska,項目名稱:MT_Core,代碼行數:28,代碼來源:DataManager.java

示例5: loadGecksFromDisk

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public void loadGecksFromDisk() {
	file = new PluginFile(main, "gecks", FileType.YAML);
	YamlConfiguration config = file.returnYaml();

	for (String locaString : config.getStringList("gecks")) {
		Location loc = StringUtilities.stringToLocation(locaString);
		GeckObject geck = new GeckObject(loc);
		geck.setCorrect(true);
		geck.setPowered(true);
		
		gecklocationMap.put(loc, geck);
	}
}
 
開發者ID:kadeska,項目名稱:MT_Core,代碼行數:14,代碼來源:GeckObjectManager.java

示例6: loadFile

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public void loadFile() {
	file = new PluginFile(main, "generators", FileType.YAML);
	for (World w : Bukkit.getWorlds()) {
		powerable.put(w.getName(), new ManyMap<>());
		generators.put(w.getName(), new ManyMap<>());
	}

	YamlConfiguration config = file.returnYaml();

	for (String locString : config.getStringList("gens")) {
		Location loc = StringUtilities.stringToLocation(locString);

		ManyMap<String, Location> mm = generators.get(loc.getWorld().getName());
		mm.addValue(loc.getChunk().getX() + ";" + loc.getChunk().getZ(), loc);
		generators.put(loc.getWorld().getName(), mm);

		for (Block bloc : getNearbyBlocks(loc.getBlock(), 15)) {
			Location ploc = bloc.getLocation();
			ManyMap<String, Location> pmm = powerable.get(ploc.getWorld().getName());
			pmm.addValue(ploc.getChunk().getX() + ";" + ploc.getChunk().getZ(), ploc);
			powerable.put(ploc.getWorld().getName(), pmm);
		}
	}

}
 
開發者ID:kadeska,項目名稱:MT_Core,代碼行數:26,代碼來源:GeneratorListener.java

示例7: loadMessagesFromDisk

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public void loadMessagesFromDisk() {
	file = new PluginFile("textMessages", FileType.YAML);
	YamlConfiguration config = file.returnYaml();
	
	for (String s : config.getStringList("messages")) {
		String[] split = s.split("-");
		
		textMessages.add(new TextMessage(split[0], split[1], split[2]));
	}

}
 
開發者ID:kadeska,項目名稱:MT_Communication,代碼行數:12,代碼來源:TextMessageManager.java

示例8: readConfig

import org.bukkit.configuration.file.YamlConfiguration; //導入方法依賴的package包/類
public void readConfig(YamlConfiguration config) {
    for (String name : config.getStringList("blacklists")) {
        ProxyBlacklist blacklist = null;
        String blacklistType = config.getString("blacklists." + name + ".type");
        if (blacklistType.equals("A")) {
            blacklist = new ProxyBlacklist(config.getString("blacklists." + name + ".address"), name, (bl, inetAddress) -> {
                if (inetAddress instanceof Inet4Address) {
                    String addr = inetAddress.getHostAddress();
                    String[] segs = addr.split(".");
                    StringBuilder builder = new StringBuilder();
                    for (int i = segs.length - 1; i >= 0; i--) {
                        builder.append(segs[i]);
                        builder.append(".");
                    }
                    builder.append(bl);
                    String lookup = builder.toString();
                    try {
                        InetAddress.getByName(lookup);
                    } catch (UnknownHostException e) {
                        return false;
                    }
                    return true;
                } else {
                    plugin.getLogger().warning("Inet Address " + inetAddress.getCanonicalHostName() + " is not IPv4, somehow.");
                    return false;
                }
            }, config.getString("blacklists." + name + ".on-match"));
            plugin.getLogger().info("Registered blacklist " + blacklist.getName() + " with address " + blacklist.getRootAddress());
        }
        plugin.addProxyBlacklist(blacklist);
    }
}
 
開發者ID:0x277F,項目名稱:mopm,代碼行數:33,代碼來源:MopmConfiguration.java

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


注:本文中的org.bukkit.configuration.file.YamlConfiguration.getStringList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。