Java Code Examples for org.bukkit.configuration.file.FileConfiguration#getMapList()
The following examples show how to use
org.bukkit.configuration.file.FileConfiguration#getMapList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigCultureBiomeInfo.java From civcraft with GNU General Public License v2.0 | 6 votes |
public static void loadConfig(FileConfiguration cfg, Map<String, ConfigCultureBiomeInfo> culture_biomes) { culture_biomes.clear(); List<Map<?, ?>> list = cfg.getMapList("culture_biomes"); for (Map<?,?> cl : list) { ConfigCultureBiomeInfo biome = new ConfigCultureBiomeInfo(); biome.name = (String)cl.get("name"); biome.coins = (Double)cl.get("coins"); biome.hammers = (Double)cl.get("hammers"); biome.growth = (Double)cl.get("growth"); biome.happiness = (Double)cl.get("happiness"); biome.beakers = (Double)cl.get("beakers"); culture_biomes.put(biome.name, biome); } CivLog.info("Loaded "+culture_biomes.size()+" Culture Biomes."); }
Example 2
Source File: ConfigRemovedRecipes.java From civcraft with GNU General Public License v2.0 | 6 votes |
public static void removeRecipes(FileConfiguration cfg, HashMap<Integer, ConfigRemovedRecipes> removedRecipies){ List<Map<?, ?>> configMaterials = cfg.getMapList("removed_recipes"); for (Map<?, ?> b : configMaterials) { ConfigRemovedRecipes item = new ConfigRemovedRecipes(); item.type_id = (Integer)b.get("type_id"); item.data = (Integer)b.get("data"); removedRecipies.put(item.type_id, item); Iterator<Recipe> it = Bukkit.getServer().recipeIterator(); while (it.hasNext()) { Recipe recipe = it.next(); if (recipe instanceof ShapedRecipe) { ShapedRecipe shapedRecipe = (ShapedRecipe)recipe; if (ItemManager.getId(shapedRecipe.getResult()) == item.type_id && shapedRecipe.getResult().getDurability() == (short)item.data) { it.remove(); break; } } } } }
Example 3
Source File: ConfigTownLevel.java From civcraft with GNU General Public License v2.0 | 6 votes |
public static void loadConfig(FileConfiguration cfg, Map<Integer, ConfigTownLevel> levels) { levels.clear(); List<Map<?, ?>> culture_levels = cfg.getMapList("town_levels"); for (Map<?, ?> level : culture_levels) { ConfigTownLevel town_level = new ConfigTownLevel(); town_level.level = (Integer)level.get("level"); town_level.title = (String)level.get("title"); town_level.upkeep = (Double)level.get("upkeep"); town_level.plots = (Integer)level.get("plots"); town_level.plot_cost = (Double)level.get("plot_cost"); town_level.tile_improvements = (Integer)level.get("tile_improvements"); levels.put(town_level.level, town_level); } CivLog.info("Loaded "+levels.size()+" town levels."); }
Example 4
Source File: ConfigStableHorse.java From civcraft with GNU General Public License v2.0 | 6 votes |
public static void loadConfig(FileConfiguration cfg, Map<Integer, ConfigStableHorse> horses) { horses.clear(); List<Map<?, ?>> config_horses = cfg.getMapList("stable_horses"); for (Map<?, ?> level : config_horses) { ConfigStableHorse horse = new ConfigStableHorse(); horse.id = (Integer)level.get("id"); horse.speed = (Double)level.get("speed"); horse.jump = (Double)level.get("jump"); horse.health = (Double)level.get("health"); horse.variant = (String)level.get("variant"); Boolean mule = (Boolean)level.get("mule"); if (mule == null || mule == false) { horse.mule = false; } else { horse.mule = true; } horses.put(horse.id, horse); } CivLog.info("Loaded "+horses.size()+" Horses."); }
Example 5
Source File: ConfigBuff.java From civcraft with GNU General Public License v2.0 | 6 votes |
public static void loadConfig(FileConfiguration cfg, Map<String, ConfigBuff> buffs){ buffs.clear(); List<Map<?, ?>> configBuffs = cfg.getMapList("buffs"); for (Map<?, ?> b : configBuffs) { ConfigBuff buff = new ConfigBuff(); buff.id = (String)b.get("id"); buff.name = (String)b.get("name"); buff.description = (String)b.get("description"); buff.description = CivColor.colorize(buff.description); buff.value = (String)b.get("value"); buff.stackable = (Boolean)b.get("stackable"); buff.parent = (String)b.get("parent"); if (buff.parent == null) { buff.parent = buff.id; } buffs.put(buff.id, buff); } CivLog.info("Loaded "+buffs.size()+" Buffs."); }
Example 6
Source File: ConfigMission.java From civcraft with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("unchecked") public static void loadConfig(FileConfiguration cfg, Map<String, ConfigMission> missions){ missions.clear(); List<Map<?, ?>> configMissions = cfg.getMapList("missions"); for (Map<?, ?> b : configMissions) { ConfigMission mission = new ConfigMission(); mission.id = (String)b.get("id"); mission.name = (String)b.get("name"); mission.cost = (Double)b.get("cost"); mission.range = (Double)b.get("range"); mission.cooldown = (Double)b.get("cooldown"); mission.intel = (Integer)b.get("intel"); mission.length = (Integer)b.get("length"); mission.fail_chance = (Double)b.get("fail_chance"); mission.compromise_chance = (Double)b.get("compromise_chance"); mission.slot = (Integer)b.get("slot"); mission.description = (List<String>) b.get("description"); missions.put(mission.id.toLowerCase(), mission); } CivLog.info("Loaded "+missions.size()+" Espionage Missions."); }
Example 7
Source File: ConfigGrocerLevel.java From civcraft with GNU General Public License v2.0 | 6 votes |
public static void loadConfig(FileConfiguration cfg, Map<Integer, ConfigGrocerLevel> levels) { levels.clear(); List<Map<?, ?>> culture_levels = cfg.getMapList("grocer_levels"); for (Map<?, ?> level : culture_levels) { ConfigGrocerLevel grocer_level = new ConfigGrocerLevel(); grocer_level.level = (Integer)level.get("level"); grocer_level.itemName = (String)level.get("itemName"); grocer_level.itemId = (Integer)level.get("itemId"); grocer_level.itemData = (Integer)level.get("itemData"); grocer_level.amount = (Integer)level.get("amount"); grocer_level.price = (Double)level.get("price"); levels.put(grocer_level.level, grocer_level); } CivLog.info("Loaded "+levels.size()+" grocer levels."); }
Example 8
Source File: ConfigGovernment.java From civcraft with GNU General Public License v2.0 | 6 votes |
public static void loadConfig(FileConfiguration cfg, Map<String, ConfigGovernment> government_map) { government_map.clear(); List<Map<?, ?>> techs = cfg.getMapList("governments"); for (Map<?, ?> level : techs) { ConfigGovernment gov = new ConfigGovernment(); gov.id = (String)level.get("id"); gov.displayName = (String)level.get("displayName"); gov.require_tech = (String)level.get("require_tech"); gov.trade_rate = (Double)level.get("trade_rate"); gov.upkeep_rate = (Double)level.get("upkeep_rate"); gov.cottage_rate = (Double)level.get("cottage_rate"); gov.growth_rate = (Double)level.get("growth_rate"); gov.culture_rate = (Double)level.get("culture_rate"); gov.hammer_rate = (Double)level.get("hammer_rate"); gov.beaker_rate = (Double)level.get("beaker_rate"); gov.maximum_tax_rate = (Double)level.get("maximum_tax_rate"); government_map.put(gov.id, gov); } CivLog.info("Loaded "+government_map.size()+" governments."); }
Example 9
Source File: ConfigFishing.java From civcraft with GNU General Public License v2.0 | 6 votes |
public static void loadConfig(FileConfiguration cfg, ArrayList<ConfigFishing> configList) { configList.clear(); List<Map<?, ?>> drops = cfg.getMapList("fishing_drops"); for (Map<?, ?> item : drops) { ConfigFishing g = new ConfigFishing(); g.craftMatId = (String)item.get("craftMatId"); g.type_id = (Integer)item.get("type_id"); g.drop_chance = (Double)item.get("drop_chance"); configList.add(g); } CivLog.info("Loaded "+configList.size()+" fishing drops."); }
Example 10
Source File: ConfigHappinessState.java From civcraft with GNU General Public License v2.0 | 6 votes |
public static void loadConfig(FileConfiguration cfg, Map<Integer, ConfigHappinessState> happiness_states) { happiness_states.clear(); List<Map<?, ?>> list = cfg.getMapList("happiness.states"); for (Map<?,?> cl : list) { ConfigHappinessState happy_level = new ConfigHappinessState(); happy_level.level = (Integer)cl.get("level"); happy_level.name = (String)cl.get("name"); happy_level.color = (String)cl.get("color"); happy_level.amount = (Double)cl.get("amount"); happy_level.beaker_rate = (Double)cl.get("beaker_rate"); happy_level.coin_rate = (Double)cl.get("coin_rate"); happy_level.culture_rate = (Double)cl.get("culture_rate"); happy_level.hammer_rate = (Double)cl.get("hammer_rate"); happiness_states.put(happy_level.level, happy_level); } CivLog.info("Loaded "+happiness_states.size()+" Happiness States."); }
Example 11
Source File: ConfigTech.java From civcraft with GNU General Public License v2.0 | 6 votes |
public static void loadConfig(FileConfiguration cfg, Map<String, ConfigTech> tech_maps) { tech_maps.clear(); List<Map<?, ?>> techs = cfg.getMapList("techs"); for (Map<?, ?> confTech : techs) { ConfigTech tech = new ConfigTech(); tech.id = (String)confTech.get("id"); tech.name = (String)confTech.get("name"); tech.beaker_cost = (Double)confTech.get("beaker_cost"); tech.cost = (Double)confTech.get("cost"); tech.require_techs = (String)confTech.get("require_techs"); tech.points = (Integer)confTech.get("points"); tech_maps.put(tech.id, tech); } CivLog.info("Loaded "+tech_maps.size()+" technologies."); }
Example 12
Source File: ConfigTownUpgrade.java From civcraft with GNU General Public License v2.0 | 6 votes |
public static void loadConfig(FileConfiguration cfg, Map<String, ConfigTownUpgrade> upgrades) { upgrades.clear(); List<Map<?, ?>> culture_levels = cfg.getMapList("upgrades"); for (Map<?, ?> level : culture_levels) { ConfigTownUpgrade town_upgrade = new ConfigTownUpgrade(); town_upgrade.id = (String)level.get("id"); town_upgrade.name = (String)level.get("name"); town_upgrade.cost = (Double)level.get("cost"); town_upgrade.action = (String)level.get("action"); town_upgrade.require_upgrade = (String)level.get("require_upgrade"); town_upgrade.require_tech = (String)level.get("require_tech"); town_upgrade.require_structure = (String)level.get("require_structure"); town_upgrade.category = (String)level.get("category"); Integer categoryCount = categories.get(town_upgrade.category); if (categoryCount == null) { categories.put(town_upgrade.category.toLowerCase(), 1); } else { categories.put(town_upgrade.category.toLowerCase(), categoryCount+1); } upgrades.put(town_upgrade.id, town_upgrade); } CivLog.info("Loaded "+upgrades.size()+" town upgrades."); }
Example 13
Source File: ConfigEnchant.java From civcraft with GNU General Public License v2.0 | 5 votes |
public static void loadConfig(FileConfiguration cfg, Map<String, ConfigEnchant> enchant_map) { enchant_map.clear(); List<Map<?, ?>> techs = cfg.getMapList("enchants"); for (Map<?, ?> level : techs) { ConfigEnchant enchant = new ConfigEnchant(); enchant.id = (String)level.get("id"); enchant.name = (String)level.get("name"); enchant.description = (String)level.get("description"); enchant.cost = (Double)level.get("cost"); enchant.enchant_id = (String)level.get("enchant_id"); enchant_map.put(enchant.id, enchant); } CivLog.info("Loaded "+enchant_map.size()+" enchantments."); }
Example 14
Source File: ConfigPlatinumReward.java From civcraft with GNU General Public License v2.0 | 5 votes |
public static void loadConfig(FileConfiguration cfg, Map<String, ConfigPlatinumReward> rewards) { rewards.clear(); List<Map<?, ?>> culture_levels = cfg.getMapList("platinum"); for (Map<?, ?> level : culture_levels) { ConfigPlatinumReward reward = new ConfigPlatinumReward(); reward.name = (String)level.get("name"); reward.amount = (Integer)level.get("amount"); reward.occurs = (String)level.get("occurs"); rewards.put(reward.name, reward); } CivLog.info("Loaded "+rewards.size()+" platinum rewards.."); }
Example 15
Source File: ConfigPerk.java From civcraft with GNU General Public License v2.0 | 5 votes |
public static void loadConfig(FileConfiguration cfg, Map<String, ConfigPerk> perk_map) { perk_map.clear(); List<Map<?, ?>> perks = cfg.getMapList("perks"); for (Map<?, ?> obj : perks) { ConfigPerk p = new ConfigPerk(); p.id = (String)obj.get("id"); p.display_name = (String)obj.get("display_name"); p.type_id = (Integer)obj.get("item_id"); p.data = (Integer)obj.get("data"); p.components = new LinkedList<HashMap<String, String>>(); @SuppressWarnings("unchecked") List<Map<?, ?>> comps = (List<Map<?, ?>>) obj.get("components"); if (comps != null) { for (Map<?, ?> compObj : comps) { HashMap<String, String> compMap = new HashMap<String, String>(); for (Object key : compObj.keySet()) { compMap.put((String)key, (String)compObj.get(key)); } p.components.add(compMap); } } perk_map.put(p.id, p); } CivLog.info("Loaded "+perk_map.size()+" Perks."); }
Example 16
Source File: ConfigTownHappinessLevel.java From civcraft with GNU General Public License v2.0 | 5 votes |
public static void loadConfig(FileConfiguration cfg, Map<Integer, ConfigTownHappinessLevel> town_happiness_levels) { town_happiness_levels.clear(); List<Map<?, ?>> list = cfg.getMapList("happiness.town_levels"); for (Map<?,?> cl : list ) { ConfigTownHappinessLevel happy_level = new ConfigTownHappinessLevel(); happy_level.level = (Integer)cl.get("level"); happy_level.happiness = (Double)cl.get("happiness"); town_happiness_levels.put(happy_level.level, happy_level); } CivLog.info("Loaded "+town_happiness_levels.size()+" Town Happiness levels."); }
Example 17
Source File: ConfigTechPotion.java From civcraft with GNU General Public License v2.0 | 5 votes |
public static void loadConfig(FileConfiguration cfg, Map<Integer, ConfigTechPotion> techPotions) { techPotions.clear(); List<Map<?, ?>> techs = cfg.getMapList("potions"); for (Map<?, ?> confTech : techs) { ConfigTechPotion tech = new ConfigTechPotion(); tech.name = (String)confTech.get("name"); tech.data = (Integer)confTech.get("data"); tech.require_tech = (String)confTech.get("require_tech"); techPotions.put(Integer.valueOf(tech.data), tech); } CivLog.info("Loaded "+techPotions.size()+" tech potions."); }
Example 18
Source File: ConfigHemisphere.java From civcraft with GNU General Public License v2.0 | 5 votes |
public static void loadConfig(FileConfiguration cfg, Map<String, ConfigHemisphere> hemis){ hemis.clear(); List<Map<?, ?>> configHemis = cfg.getMapList("hemispheres"); for (Map<?, ?> b : configHemis) { ConfigHemisphere buff = new ConfigHemisphere(); buff.id = (String)b.get("id"); buff.x_min = (Integer)b.get("x_min"); buff.x_max = (Integer)b.get("x_max"); buff.z_min = (Integer)b.get("z_min"); buff.z_max = (Integer)b.get("z_max"); hemis.put(buff.id, buff); } CivLog.info("Loaded "+hemis.size()+" Hemispheres."); }
Example 19
Source File: ConfigCampUpgrade.java From civcraft with GNU General Public License v2.0 | 5 votes |
public static void loadConfig(FileConfiguration cfg, Map<String, ConfigCampUpgrade> upgrades) { upgrades.clear(); List<Map<?, ?>> culture_levels = cfg.getMapList("upgrades"); for (Map<?, ?> level : culture_levels) { ConfigCampUpgrade upgrade = new ConfigCampUpgrade(); upgrade.id = (String)level.get("id"); upgrade.name = (String)level.get("name"); upgrade.cost = (Double)level.get("cost"); upgrade.action = (String)level.get("action"); upgrade.require_upgrade = (String)level.get("require_upgrade"); upgrades.put(upgrade.id, upgrade); } CivLog.info("Loaded "+upgrades.size()+" camp upgrades."); }
Example 20
Source File: ConfigTechItem.java From civcraft with GNU General Public License v2.0 | 5 votes |
public static void loadConfig(FileConfiguration cfg, Map<Integer, ConfigTechItem> tech_maps) { tech_maps.clear(); List<Map<?, ?>> techs = cfg.getMapList("items"); for (Map<?, ?> confTech : techs) { ConfigTechItem tech = new ConfigTechItem(); tech.id = (Integer)confTech.get("id"); tech.name = (String)confTech.get("name"); tech.require_tech = (String)confTech.get("require_tech"); tech_maps.put(tech.id, tech); } CivLog.info("Loaded "+tech_maps.size()+" technologies."); }