本文整理汇总了Java中org.bukkit.configuration.Configuration.getStringList方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getStringList方法的具体用法?Java Configuration.getStringList怎么用?Java Configuration.getStringList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.getStringList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseBlocksSection
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
/**
* Parse blocks section entry
*
* @param configuration
* @return
*/
private static BlockEntry[] parseBlocksSection(Configuration configuration) {
List<BlockEntry> blocks = new ArrayList();
for (String string : configuration.getStringList("blocks")) {
try {
BlockEntry entry = BlockEntry.parse(string);
if (entry == null) {
MCPainterMain.log("* Error parsing block entry: " + string);
} else {
blocks.add(entry);
}
} catch (Exception e) {
MCPainterMain.log("* Error parsing block entry: " + string);
}
}
return blocks.toArray(new BlockEntry[0]);
}
示例2: loadConfig
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
private void loadConfig(Configuration config) {
items = new ArrayList<ShopItem>();
List<String> list = config.getStringList(name.toLowerCase());
for (String entry : list) {
if (entry.equalsIgnoreCase("nextline")) {
int end = 9 * (int) Math.ceil(items.size() / 9.0);
for (int i = items.size(); i < end; i++)
items.add(null);
} else {
String[] params = entry.split(",");
if (params.length >= 3) {
Material type = Material.getMaterial(params[0]);
int qty = Integer.valueOf(params[1]);
int price = Integer.valueOf(params[2]);
ShopItem item = new ShopItem(type, qty, price);
if (params.length >= 4) {
String itemName = params[3].replace("\"", "");
// Longest method name ever. Great job bukkit team.
item.setName(ChatColor.translateAlternateColorCodes(
'&', itemName));
}
items.add(item);
}
}
}
}
示例3: parseConfiguration
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
public static void parseConfiguration(@Nonnull Configuration config) {
Preconditions.checkNotNull(config, "configuration");
ConfigurationSection flairsConfig = (ConfigurationSection) config.get("flairs");
for(String flair : flairsConfig.getKeys(false)) {
FlairManager flairManager = new FlairManager(flair);
ConfigurationSection flairConfig = (ConfigurationSection) flairsConfig.get(flair);
FlairManager.flairs.put(flair, flairConfig.getString("flair", "*"));
DefaultPriority defaultPriority = flairConfig.getString("default", "after").equalsIgnoreCase("before") ? DefaultPriority.BEFORE : DefaultPriority.AFTER;
List<String> rawPriority = flairConfig.getStringList("priority");
List<ChatColor> priority = Lists.newArrayListWithCapacity(rawPriority.size());
for(String str : rawPriority) {
ChatColor c = parseChatColor(str);
if(c != null) {
priority.add(c);
} else {
Bukkit.getLogger().warning("Failed to parse '" + str + "' color priority for flair " + flairConfig.getName());
}
}
flairManager.setPriority(flair, priority, defaultPriority);
}
FlairManager.flairOrder = config.getStringList("order");
}
示例4: ChestKitsConfiguration
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
public ChestKitsConfiguration(Configuration config, Logger log) {
kits = new HashMap<String, ChestKitsKit>();
List<String> listOfKits = config.getStringList("kits");
if (listOfKits != null) {
for (String kitName : listOfKits) {
log.info("Loading kit " + kitName);
List<?> items = config.getList("kititems." + kitName);
if (items == null) {
log.severe("Kit " + kitName + " has no items defined! Skipping...");
continue;
}
List<ItemStack> itemStacks = new LinkedList<ItemStack>();
for (Object o : items) {
if (o instanceof ItemStack) {
itemStacks.add((ItemStack)o);
} else {
log.severe("Invalid object found in configuration for kit " + kitName + ": " + o);
}
}
long cooldown = config.getLong("kitcooldown." + kitName, 0L);
ChestKitsKit kit = new ChestKitsKit(kitName, itemStacks);
kit.setCooldown(cooldown);
addKit(kitName, kit);
}
}
log.info("Successfully loaded " + kits.size() + " kits.");
}
示例5: VersionInfo
import org.bukkit.configuration.Configuration; //导入方法依赖的package包/类
public VersionInfo(final Configuration updateConfig, final String path)
{
changelog = updateConfig.getStringList(path + ".changelog");
minBukkit = updateConfig.getInt(path + ".min-bukkit", 0);
maxBukkit = updateConfig.getInt(path + ".max-bukkit", 0);
modules = new HashMap<String, ModuleInfo>();
final String modulesPath = path + ".modules";
for (String module : updateConfig.getKeys(false))
{
modules.put(module, new ModuleInfo(updateConfig, modulesPath + module));
}
}