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


Java ConfigurationSection.getStringList方法代码示例

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


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

示例1: deserialize

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
/**
 * Deserialize items.
 */
public static ItemStack deserialize(ConfigurationSection section) {
    Material type = Material.getMaterial(section.getString("type"));
    byte data = (byte) section.getInt("data");

    ItemBuilder item = new ItemBuilder(type, data);

    item.setAmount(section.getInt("amount"));
    item.setDurability((short) section.getInt("durability"));

    item.setDisplayName(section.getString("displayName"));
    item.setLore(section.getString("lore"));

    List<String> enchants = section.getStringList("enchantments");
    for (String enchant : enchants) {
        String tmp[] = enchant.split(",");

        Enchantment enc = Enchantment.getByName(tmp[0]);
        int lev = Integer.parseInt(tmp[1]);

        item.addEnchantment(enc, lev);
    }

    return item.build();
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:28,代码来源:ItemBuilder.java

示例2: getIndexTopics

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
/**
 * Extracts a list of all index topics from help.yml
 *
 * @return A list of index topics.
 */
public List<HelpTopic> getIndexTopics() {
    List<HelpTopic> topics = new LinkedList<HelpTopic>();
    ConfigurationSection indexTopics = helpYaml.getConfigurationSection("index-topics");
    if (indexTopics != null) {
        for (String topicName : indexTopics.getKeys(false)) {
            ConfigurationSection section = indexTopics.getConfigurationSection(topicName);
            String shortText = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("shortText", ""));
            String preamble = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("preamble", ""));
            String permission = ChatColor.translateAlternateColorCodes(ALT_COLOR_CODE, section.getString("permission", ""));
            List<String> commands = section.getStringList("commands");
            topics.add(new CustomIndexHelpTopic(server.getHelpMap(), topicName, shortText, permission, commands, preamble));
        }
    }
    return topics;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:21,代码来源:HelpYamlReader.java

示例3: getCommandAliases

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
@Override
public Map<String, String[]> getCommandAliases() {
    ConfigurationSection section = commandsConfiguration.getConfigurationSection("aliases");
    Map<String, String[]> result = new LinkedHashMap<String, String[]>();

    if (section != null) {
        for (String key : section.getKeys(false)) {
            List<String> commands;

            if (section.isList(key)) {
                commands = section.getStringList(key);
            } else {
                commands = ImmutableList.of(section.getString(key));
            }

            result.put(key, commands.toArray(new String[commands.size()]));
        }
    }

    return result;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:22,代码来源:CraftServer.java

示例4: CraftExtension

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
CraftExtension(String name, ConfigurationSection config) {
    this.name = name;
    this.capItem = CraftManager.getCapItem().clone();
    ItemMeta meta = capItem.getItemMeta();
    meta.setDisplayName(StringUtils.coloredLine(config.getString("name")));
    if (config.contains("lore")) {
        meta.setLore(StringUtils.coloredLines(config.getStringList("lore")));
    }
    this.capItem.setItemMeta(meta);
    this.slots = config.getIntegerList("slots");

    if (config.contains("includes")) {
        this.includes = new ArrayList<>();

        for (String childName : config.getStringList("includes")) {
            CraftExtension child = CraftManager.getByName(childName);
            if (child != null) {
                includes.add(child);
            }
        }
    } else {
        this.includes = null;
    }
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:25,代码来源:CraftExtension.java

示例5: CommandPlus

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public CommandPlus(ConfigurationSection section, MessageManager manager, String name){
	this.name = name;
	this.description		= manager.getComponentManager().get(section.getString(Node.DESCRIPTION.get()));
	this.usage				= manager.getComponentManager().get(section.getString(Node.USAGE.get()));
	this.requirement		= new Requirement(section.get(Node.REQUIREMENT.get()), manager.getComponentManager());
	this.takeRequirement	= section.getBoolean("TAKE_REQUIREMENT", true);
	if(section.contains(Node.NO_REQUIREMENT.get()))
		this.noRequirement = manager.get(section.getString(Node.NO_REQUIREMENT.get()));
	else
		this.noRequirement = null;
	List<String> aliases = section.getStringList(Node.ALIASES.get());
	this.aliases = new ArrayList<String>();
	if(aliases!=null){
		List<String>patchBukkit = new ArrayList<String>();
		patchBukkit.addAll(aliases);
		for(String s : patchBukkit)
			this.aliases.add(s.toLowerCase());
	}
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:20,代码来源:CommandPlus.java

示例6: loadConfig

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
private void loadConfig() {
    FileConfiguration config = new YamlConfiguration();
    try {
        config.load(new File(getDataFolder(), "config.yml"));
        config.options().copyDefaults(true);

        String user = config.getString("jdbc-username", "root");
        String password = config.getString("jdbc-password", "password");
        String jdbcUrl = config.getString("jdbc-url", "jdbc:mysql://localhost:3306/minecraft");

        databaseManager = new DatabaseManager(jdbcUrl, user, password);
        databaseManager.connect();

        ConfigurationSection definitions = config.getConfigurationSection("definitions");
        for (String definitionKey : definitions.getKeys(false)) {
            ConfigurationSection definition = definitions.getConfigurationSection(definitionKey);

            int priority = definition.getInt("priority", 1);
            ImageType type = ImageType.valueOf(definition.getString("type", ImageType.OVERLAY.name()));
            String permission = definition.getString("permission");
            List<String> images = definition.getStringList("images");

            SpigotImageDetails imageDetails = new SpigotImageDetails(priority, type, permission, images);
            imageHandler.addImage(imageDetails);
        }

        config.save(new File(getDataFolder(), "config.yml"));
    } catch (IOException | InvalidConfigurationException e) {
        e.printStackTrace();
    }
}
 
开发者ID:me4502,项目名称:AdvancedServerListIcons,代码行数:32,代码来源:AdvancedServerListIconsSpigot.java

示例7: load

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public static void load(ConfigurationSection servers) {
	for (String name : servers.getKeys(false)) {
		List<ServerRange> ranges = new ArrayList<ServerRange>();
		for (String raw : servers.getStringList(name + ".servers")) {
			String ip = raw.split(":")[0];
			
			String ports = raw.split(":")[1];
			int first = Integer.parseInt(ports.split(",")[0]);
			int second = Integer.parseInt(ports.split(",")[1]);
			
			ranges.add(new ServerRange(ip, first, second));
		}
		
		List<Block> blocks = new ArrayList<Block>();
		for (String s : servers.getStringList(name + ".signs")) {
			
	        int x = Integer.parseInt(s.split(",")[0]);
	        int y = Integer.parseInt(s.split(",")[1]);
	        int z = Integer.parseInt(s.split(",")[2]);

			Block b = Bukkit.getWorld("void").getBlockAt(x, y, z);
			blocks.add(b);
		}
		
		MiniGame g = new MiniGame(ranges, blocks);
		g.setTitle(servers.getString(name + ".title"));
	}
	Chat.log("Loaded " + MiniGame.getList().size() + " minigames!");
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:30,代码来源:MiniGame.java

示例8: PetFood

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
PetFood(ConfigurationSection config) {
    super(config.getString("item"));

    this.name = StringUtils.coloredLine(config.getString("name"));
    this.lore = StringUtils.coloredLines(config.getStringList("lore"));
    this.value = config.getDouble("value");
    this.eaters = config.getStringList("eaters");

    this.createFoodItem(config.getName());
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:11,代码来源:PetFood.java

示例9: CustomItem

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
CustomItem(String id, ConfigurationSection config) {
    super(config, config.getString("texture"));

    Rarity rarity = Rarity.valueOf(config.getString("rarity"));
    this.name = StringUtils.coloredLine(rarity.getColor() + config.getString("name"));

    if (config.contains("stats")) {
        for (String stat : config.getStringList("stats")) {
            this.stats.add(new ItemStat(ItemStat.StatType.valueOf(stat.split(" ")[0]), stat.split(" ")[1]));
        }
    }

    this.lore = config.contains("lore") ? StringUtils.coloredLines(config.getStringList("lore")) : null;

    this.leftClickAction = config.contains("abilities.left-click.command")
            ? new ItemAction(config.getConfigurationSection("abilities.left-click"))
            : null;
    this.rightClickAction = config.contains("abilities.right-click.command")
            ? new ItemAction(config.getConfigurationSection("abilities.right-click"))
            : null;

    this.permissions = config.contains("abilities.permissions") ? config.getStringList("abilities.permissions") : null;
    this.drop = config.getBoolean("drop", true);
    this.unbreakable = config.getBoolean("unbreakable", false);
    this.statsHidden = config.getBoolean("hide-stats", false);

    this.createItem(id);
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:29,代码来源:CustomItem.java

示例10: Icon

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public Icon(ConfigurationSection section, MessageManager manager) {
	if(section.getConfigurationSection(Node.ITEM.get())!=null){
		ErrorLogger.addPrefix(Node.ITEM.get());
		item = MinecraftUtils.loadItem(section.getConfigurationSection(Node.ITEM.get()));
		ErrorLogger.removePrefix();
	}
	skullSelf 		= section.getBoolean("SKULL_SELF", false);
	closeOnClick 	= section.getBoolean(Node.CLOSE.get(), false);
	canMove 		= section.getBoolean(Node.MOVE.get(), false);
	if(!canMove && item != null && item.getType() != Material.AIR)
		item = MinecraftUtils.setExtra(item, FREEZE, "1");
	if(item == null)
		item = air;
	if(skullSelf && item.getType() != Material.SKULL_ITEM)
		skullSelf = false;
	if(skullSelf)
		item.setDurability((short) 3);
	if(section.contains(Node.NAME_PATH.get())){
		name = manager.getComponentManager().get(section.getString(Node.NAME_PATH.get()));
		if(isStatic && name != null)
			isStatic = false;
	}
	if(section.contains(Node.LORE_PATH.get())){
		lore = new ArrayList<MComponent>();
		if(!section.getStringList(Node.LORE_PATH.get()).isEmpty()) {
			for(String key : section.getStringList(Node.LORE_PATH.get())){
				MComponent temp = manager.getComponentManager().get(key);
				if(temp == null)
					continue;
				lore.add(temp);
				if(isStatic)
					isStatic = false;
			}
		}else if(section.getString(Node.LORE_PATH.get()) != null) {
			lore.add(manager.getComponentManager().get(section.getString(Node.LORE_PATH.get())));
		}
	}
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:39,代码来源:Icon.java

示例11: init

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
public void init(VanillaPlusCore core) {
	if(core == null)return;
	ConfigurationSection section = ConfigUtils.getYaml(core.getInstance(), "Command", false);
	if(section == null)return;
	ErrorLogger.addPrefix("Command.yml");
	ConfigurationSection temp = section.getConfigurationSection(Node.SETTINGS.get());
	ErrorLogger.addPrefix(Node.SETTINGS.get());
	if(temp == null){
		Error.MISSING.add();
    	topHelp			= core.getMessageManager().get(null);
    	commandHelp		= core.getMessageManager().get(null);
    	noRequirement	= core.getMessageManager().get(null);
   		ErrorLogger.removePrefix();
		return;
	}else{
    	topHelp			= core.getMessageManager().get(temp.getString("TOP_HELP"));
    	commandHelp		= core.getMessageManager().get(temp.getString("HELP"));
    	noRequirement	= core.getMessageManager().get(temp.getString(Node.NO_REQUIREMENT.get()));
    	List<String>toRemove = temp.getStringList("TO_REMOVE");
    	if(toRemove != null && !toRemove.isEmpty()){
    		for(String s : toRemove)
    			commandMap.remove(s);
    	}
	}
   	for(CommandPlus cmd : getLoaded()){
   		register(cmd);
   	}
   	commandMap.put(PlaceH.HELP.get(), new LinkCommand(PlaceH.HELP.get(), PlaceH.HELP.get(),
			"/"+PlaceH.HELP.get()+" [page]", Arrays.asList(PlaceH.HELP.get()), null));
	ErrorLogger.removePrefix();
	ErrorLogger.removePrefix();
	
	
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:35,代码来源:CPManager.java

示例12: ClassedItem

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的package包/类
protected ClassedItem(ConfigurationSection config, String texture) {
    super(texture);

    this.level = config.getInt("level", -1);
    this.classes = config.contains("classes") ? config.getStringList("classes") : null;
}
 
开发者ID:EndlessCodeGroup,项目名称:RPGInventory,代码行数:7,代码来源:ClassedItem.java

示例13: parseDragonLoot

import org.bukkit.configuration.ConfigurationSection; //导入方法依赖的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.ConfigurationSection.getStringList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。