mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-30 06:33:55 +01:00
Fix upgrade waves.
This commit is contained in:
parent
9c411a21ad
commit
3b47ca407e
@ -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:
|
||||||
|
@ -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));
|
||||||
|
Loading…
Reference in New Issue
Block a user