Fix upgrade waves.

This commit is contained in:
garbagemule 2013-08-18 00:28:00 +02:00
parent 9c411a21ad
commit 3b47ca407e
2 changed files with 10 additions and 7 deletions

View File

@ -1,7 +1,7 @@
name: MobArena name: MobArena
author: garbagemule author: garbagemule
main: com.garbagemule.MobArena.MobArena main: com.garbagemule.MobArena.MobArena
version: 0.95.5.23 version: 0.95.5.24
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault] softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
commands: commands:
ma: ma:

View File

@ -379,9 +379,11 @@ public class WaveParser
String path = "upgrades."; String path = "upgrades.";
for (String className : classes) { for (String className : classes) {
String itemList;
// Legacy support // Legacy support
String itemList = config.getString(path + className, null); Object val = config.get(path + className, null);
if (itemList != null) { if (val instanceof String) {
itemList = (String) val;
List<ItemStack> stacks = ItemParser.parseItems(itemList); List<ItemStack> stacks = ItemParser.parseItems(itemList);
List<Upgrade> list = new ArrayList<Upgrade>(); List<Upgrade> list = new ArrayList<Upgrade>();
for (ItemStack stack : stacks) { for (ItemStack stack : stacks) {
@ -390,11 +392,12 @@ public class WaveParser
upgrades.put(className.toLowerCase(), list); upgrades.put(className.toLowerCase(), list);
} }
// New complex setup // New complex setup
else { else if (val instanceof ConfigurationSection) {
ConfigurationSection section = (ConfigurationSection) val;
List<Upgrade> list = new ArrayList<Upgrade>(); List<Upgrade> list = new ArrayList<Upgrade>();
// Items (Generic + Weapons) // Items (Generic + Weapons)
itemList = config.getString(path + className + ".items", null); itemList = section.getString("items", null);
if (itemList != null) { if (itemList != null) {
for (ItemStack stack : ItemParser.parseItems(itemList)) { for (ItemStack stack : ItemParser.parseItems(itemList)) {
list.add(ArenaClass.isWeapon(stack) ? new WeaponUpgrade(stack) : new GenericUpgrade(stack)); list.add(ArenaClass.isWeapon(stack) ? new WeaponUpgrade(stack) : new GenericUpgrade(stack));
@ -402,7 +405,7 @@ public class WaveParser
} }
// Armor // Armor
itemList = config.getString(path + className + ".armor", null); itemList = section.getString("armor", null);
if (itemList != null) { if (itemList != null) {
for (ItemStack stack : ItemParser.parseItems(itemList)) { for (ItemStack stack : ItemParser.parseItems(itemList)) {
list.add(new ArmorUpgrade(stack)); list.add(new ArmorUpgrade(stack));
@ -410,7 +413,7 @@ public class WaveParser
} }
// Permissions // Permissions
List<String> perms = config.getStringList(path + className + ".permissions"); List<String> perms = section.getStringList("permissions");
if (!perms.isEmpty()) { if (!perms.isEmpty()) {
for (String perm : perms) { for (String perm : perms) {
list.add(new PermissionUpgrade(perm)); list.add(new PermissionUpgrade(perm));