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


Java FileConfiguration.getStringList方法代码示例

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


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

示例1: load

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
Arena[] load() {
    final List<Arena> items = new ArrayList<>();
    for (int i = 0; (this.getFolder() != null) && (i < this.getFolder().list().length); i++) {
        final String s = this.getFolder().list()[i];
        try {
            if (s.contains("arena_")) {
                final FileConfiguration configuration = new YamlConfiguration();
                final File file = new File(this.getFolder(), s);
                configuration.load(file);
                final Map<String, Object> data = configuration.getConfigurationSection("arena").getValues(true);
                final Arena arenaEntity = new ArenaEntity(data, configuration.getStringList("arena.properties.wall-bouncing"));
                items.add(arenaEntity);
            }
        } catch (final Exception ex) {
            Bukkit.getLogger().log(Level.WARNING, "Cannot read arena file " + s + '.', ex);
        }
    }
    return items.toArray(new Arena[items.size()]);
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:20,代码来源:ArenaFileManager.java

示例2: setCombos

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public static void setCombos(String p, int index, String click) {
	File pFile = new File(Main.getInstance().getDataFolder(), "Players/" + p.toLowerCase() + ".yml");
	FileConfiguration pConfig = YamlConfiguration.loadConfiguration(pFile);
	List<String> combos = pConfig.getStringList("Combo");
	combos.remove(index);
	combos.add(index, click);
	pConfig.set("Combo", combos);
	try {
		pConfig.save(pFile);
	} catch (Exception e) {
	}
}
 
开发者ID:MohibMirza,项目名称:RPGPlus,代码行数:13,代码来源:Datafiles.java

示例3: getCrafts

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public ArrayList<CraftArray> getCrafts(){
   	ArrayList<CraftArray> craftlist = new ArrayList<CraftArray>();
   	try {
    	File craftfile = new File(plugin.getDataFolder(), "crafts.yml");
		craftfile.createNewFile();
		FileConfiguration craftconfig = YamlConfiguration.loadConfiguration(craftfile);
		if(craftconfig.isSet("Crafts")) {
			for(String craftpath : craftconfig.getConfigurationSection("Crafts").getKeys(false)) {
				craftpath = "Crafts." + craftpath;
				ArrayList<ItemStack> config_craft = (ArrayList<ItemStack>) craftconfig.getList(craftpath + ".craft");
				ArrayList<ItemStack> config_resultitems = (ArrayList<ItemStack>) craftconfig.getList(craftpath + ".result.items");
				ArrayList<Integer> config_resultprobs = (ArrayList<Integer>) craftconfig.getIntegerList(craftpath + ".result.probs");
				HashMap<ItemStack,Integer> config_result = new HashMap<ItemStack, Integer>();
				for(ItemStack resultitem : config_resultitems) {
					config_result.put(resultitem, config_resultprobs.get(config_resultitems.indexOf(resultitem)));
				}
				ArrayList<String> config_cmds = (ArrayList<String>) craftconfig.getStringList(craftpath + ".cmds");
				boolean config_redstonepower = craftconfig.getBoolean(craftpath + ".redstonepower");
				int config_experience = craftconfig.getInt(craftpath + ".experience");
				CraftArray specraft = new CraftArray(config_craft, config_result, config_cmds, config_redstonepower, config_experience);
				craftlist.add(specraft);
			}
			return craftlist;
		} else {
			return craftlist;
		}
   	} catch (Exception e) {
   		e.printStackTrace();
   		return craftlist;
   	}
   }
 
开发者ID:Slaymd,项目名称:CaulCrafting,代码行数:33,代码来源:CraftStorage.java

示例4: DataProvider

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
private DataProvider() {
    FileConfiguration config = Main.config();

    this.protection = config.getBoolean(Main.PROTECTION_KEY);
    this.kickMessage = config.getString(Main.PLAYER_KICK_KEY);
    String root = config.getString(Main.VERIFICATION_ROOT_KEY);
    if (!root.endsWith("/")) root += '/';
    root = root.replace('\\', '/');
    this.verificationRoot = root;
    this.wipeKey = config.getString(Main.WIPE_KEY);
    this.whitelist = config.getStringList(Main.WHITELIST_KEY);

    this.formattedMessage = String.format(ChatColor.translateAlternateColorCodes('&', getKickMessage()), root);

}
 
开发者ID:pietrek777,项目名称:AntiBots,代码行数:16,代码来源:DataProvider.java

示例5: load

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void load() {
    projEffectMap.clear();
    File particleFile = new File(SkyWarsReloaded.get().getDataFolder(), "projectileeffects.yml");

    if (!particleFile.exists()) {
    	SkyWarsReloaded.get().saveResource("projectileeffects.yml", false);
    }

    if (particleFile.exists()) {
        FileConfiguration storage = YamlConfiguration.loadConfiguration(particleFile);

        if (storage.contains("effects")) {
            for (String item : storage.getStringList("effects")) {
                List<String> itemData = new LinkedList<String>(Arrays.asList(item.split(" ")));

                int cost = Integer.parseInt(itemData.get(1));
    
                String effect = itemData.get(0).toLowerCase();
                String name = null;
                
                if (effects.contains(effect)) {
                	name = new Messaging.MessageFormatter().format("effects." + effect);
                }
                                    
                if (name != null) {
                	projEffectMap.put(ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', name)), new ParticleItem(effect, name, cost));
                }
            }
        }
    }
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:32,代码来源:ProjectileController.java

示例6: load

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public void load() {
    particleMap.clear();
    File particleFile = new File(SkyWarsReloaded.get().getDataFolder(), "particleeffects.yml");

    if (!particleFile.exists()) {
    	SkyWarsReloaded.get().saveResource("particleeffects.yml", false);
    }

    if (particleFile.exists()) {
        FileConfiguration storage = YamlConfiguration.loadConfiguration(particleFile);

        if (storage.contains("effects")) {
            for (String item : storage.getStringList("effects")) {
                List<String> itemData = new LinkedList<String>(Arrays.asList(item.split(" ")));

                int cost = Integer.parseInt(itemData.get(1));
    
                String effect = itemData.get(0).toLowerCase();
                String name = null;

                if (effects.contains(effect)) {
                	name = new Messaging.MessageFormatter().format("effects." + effect);
                }
                
                if (name != null) {
                	particleMap.put(ChatColor.stripColor(ChatColor.translateAlternateColorCodes('&', name)), new ParticleItem(effect, name, cost));
                }
            }
        }
    }
}
 
开发者ID:smessie,项目名称:SkyWarsReloaded,代码行数:32,代码来源:ParticleController.java

示例7: getRemoveItem

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
private ItemStack getRemoveItem(Player p){
    ConfigManager.load();
    FileConfiguration config = ConfigManager.get();

    Material mat = config.getString("gui.gui-item.item") != null ?
        Material.valueOf(config.getString("gui.gui-item.item")) : Material.PAPER;

    ItemStack is = new ItemStack(mat);
    is.setDurability(Short.valueOf(ConfigManager.getInt("gui.gui-item.data")+""));
    ItemMeta im = is.getItemMeta();

    ArrayList<String> lore = new ArrayList<>();

    String title = ColorUtil.translate(ConfigManager.getString("gui.gui-item.name"));
    String id = StorageHandler.getPlayerTag(p) != null ? StorageHandler.getPlayerTag(p) : "No";
    title = title.replace("%id%", WordUtils.capitalizeFully(id.toLowerCase()));

    im.setDisplayName(title);

    for(String l : config.getStringList("gui.gui-item.lore")){
        lore.add(ColorUtil.translate(l));
    }
    im.setLore(lore);

    is.setItemMeta(im);

    return is;
}
 
开发者ID:Chazmondo,项目名称:DogTags,代码行数:29,代码来源:TagsCommand.java

示例8: loadShortcuts

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
/**
 * Loads the emoji shortcuts from the config.
 *
 * @param config The config to load emoji shortcuts from.
 */
private void loadShortcuts(FileConfiguration config) {
	for (String key : config.getConfigurationSection("shortcuts").getKeys(false)) { // Gets all of the headers/keys in the shortcuts section
		for (String shortcutListItem : config.getStringList("shortcuts." + key)) { // Gets all of the shortcuts for the key
			shortcuts.put(shortcutListItem, ":" + key + ":");
		}
	}
}
 
开发者ID:RadBuilder,项目名称:EmojiChat,代码行数:13,代码来源:EmojiHandler.java

示例9: loadDisabledEmojis

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
/**
 * Loads the disabled emojis from the config.
 *
 * @param config The config to load disabled emojis from.
 * @param plugin The EmojiChat main class instance.
 */
private void loadDisabledEmojis(FileConfiguration config, EmojiChat plugin) {
	if (config.getBoolean("disable-emojis")) {
		for (String disabledEmoji : config.getStringList("disabled-emojis")) {
			if (disabledEmoji == null || !emojis.containsKey(disabledEmoji)) {
				plugin.getLogger().warning("Invalid emoji specified in 'disabled-emojis': '" + disabledEmoji + "'. Skipping...");
				continue;
			}
			disabledCharacters.add(emojis.remove(disabledEmoji)); // Remove disabled emojis from the emoji list
		}
	}
}
 
开发者ID:RadBuilder,项目名称:EmojiChat,代码行数:18,代码来源:EmojiHandler.java

示例10: getCombos

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
public static List<String> getCombos(String p) {
	File pFile = new File(Main.getInstance().getDataFolder(), "Players/" + p.toLowerCase() + ".yml");
	FileConfiguration pConfig = YamlConfiguration.loadConfiguration(pFile);
	List<String> combos = pConfig.getStringList("Combo");
	return combos;
}
 
开发者ID:MohibMirza,项目名称:RPGPlus,代码行数:7,代码来源:Datafiles.java

示例11: parseDragonLoot

import org.bukkit.configuration.file.FileConfiguration; //导入方法依赖的package包/类
private void parseDragonLoot() {
	if (template.file == null) return; // No file to parse loot from
	
	Logger logger = JavaPlugin.getPlugin(DragonEggDrop.class).getLogger();
	FileConfiguration dragonFile = template.configFile;
	
	// Parse the basic loot rewards (i.e. spawn chances & names)
	this.eggSpawnChance = dragonFile.getDouble("egg-spawn-chance", 100.0);
	this.eggName = ChatColor.translateAlternateColorCodes('&', dragonFile.getString("egg-name", "%dragon%&r's Egg"));
	this.eggLore = dragonFile.getStringList("egg-lore").stream()
			.map(s -> ChatColor.translateAlternateColorCodes('&', s))
			.collect(Collectors.toList());
	
	this.chestSpawnChance = dragonFile.getDouble("chest-spawn-chance", 0);
	this.chestName = dragonFile.getString("chest-name", "Loot Chest");
	this.minLootGen = dragonFile.getInt("min-loot");
	this.maxLootGen = dragonFile.getInt("max-loot");
	
	this.commands = dragonFile.getStringList("death-commands");
	
	// Parse loot items
	ConfigurationSection lootSection = dragonFile.getConfigurationSection("loot");
	if (lootSection == null) return;
	
	for (String itemKey : lootSection.getKeys(false)) {
		// Parse root values (type, damage, amount and weight)
		double weight = lootSection.getDouble(itemKey + ".weight");
		
		Material type = EnumUtils.getEnum(Material.class, lootSection.getString(itemKey + ".type").toUpperCase());
		byte data = (byte) lootSection.getInt(itemKey + ".data");
		short damage = (short) lootSection.getInt(itemKey + ".damage");
		int amount = lootSection.getInt(itemKey + ".amount");
		
		if (type == null) {
			logger.warning("Invalid material type \"" + lootSection.getString(itemKey + ".type") + "\". Ignoring loot value...");
			continue;
		}
		
		// Create new item stack with passed values
		@SuppressWarnings("deprecation")
		ItemStack item = new ItemStack(type, 1, damage, data);
		item.setAmount(amount);
		
		// Parse meta
		String displayName = lootSection.getString(itemKey + ".display-name");
		List<String> lore = lootSection.getStringList(itemKey + ".lore");
		Map<Enchantment, Integer> enchantments = new HashMap<>();
		
		// Enchantment parsing
		if (lootSection.contains(itemKey + ".enchantments")) {
			for (String enchant : lootSection.getConfigurationSection(itemKey + ".enchantments").getKeys(false)) {
				Enchantment enchantment = Enchantment.getByName(enchant);
				int level = lootSection.getInt(itemKey + ".enchantments." + enchant);
				
				if (enchantment == null || level == 0) {
					logger.warning("Invalid enchantment \"" + enchant + "\" with level " + level);
					continue;
				}
				
				enchantments.put(enchantment, level);
			}
		}
		
		// Meta updating
		ItemMeta meta = item.getItemMeta();
		if (displayName != null) meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', displayName));
		if (!lore.isEmpty()) meta.setLore(lore.stream().map(s -> ChatColor.translateAlternateColorCodes('&', s)).collect(Collectors.toList()));
		enchantments.forEach((e, level) -> meta.addEnchant(e, level, true));
		item.setItemMeta(meta);
		
		this.loot.add(weight, item);
	}
}
 
开发者ID:2008Choco,项目名称:DragonEggDrop,代码行数:74,代码来源:DragonLoot.java


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