mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-30 06:33:55 +01:00
Allow the items-node to have a list-value.
The items-node in the classes section now supports list values instead of strictly string-values. This should make it easier to see exactly which items a class has, and it should alleviate some of the problems associated with apostrophes and such. The string-valued setup is still supported to preserve some backwards compatibility. The armor-node remains untouched, but it will probably be updated to the same system later.
This commit is contained in:
parent
70060e7dc8
commit
80abcf5f24
@ -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.31
|
version: 0.95.5.32
|
||||||
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
|
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
|
||||||
commands:
|
commands:
|
||||||
ma:
|
ma:
|
||||||
|
@ -3,6 +3,7 @@ package com.garbagemule.MobArena;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -297,9 +298,19 @@ public class ArenaMasterImpl implements ArenaMaster
|
|||||||
ArenaClass arenaClass = new ArenaClass(classname, weps, arms);
|
ArenaClass arenaClass = new ArenaClass(classname, weps, arms);
|
||||||
|
|
||||||
// Parse the items-node
|
// Parse the items-node
|
||||||
String items = section.getString("items", "");
|
List<String> items = section.getStringList("items");
|
||||||
if (!items.equals("")) {
|
if (items == null || items.isEmpty()) {
|
||||||
List<ItemStack> stacks = ItemParser.parseItems(items);
|
String str = section.getString("items", "");
|
||||||
|
List<ItemStack> stacks = ItemParser.parseItems(str);
|
||||||
|
arenaClass.setItems(stacks);
|
||||||
|
} else {
|
||||||
|
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||||
|
for (String item : items) {
|
||||||
|
ItemStack stack = ItemParser.parseItem(item);
|
||||||
|
if (stack != null) {
|
||||||
|
stacks.add(stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
arenaClass.setItems(stacks);
|
arenaClass.setItems(stacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user