本文整理汇总了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);
}
示例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;
}
示例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");
}
示例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.");
}
示例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);
}
}
示例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);
}
}
}
示例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]));
}
}
示例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);
}
}
示例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()));
}
}