Fixed alias parsing for commands. object.toString().split(",") is NOT how you parse a YAML list!

By: sk89q <the.sk89q@gmail.com>
This commit is contained in:
Bukkit/Spigot 2011-02-16 21:45:15 -08:00
parent 7bfb006b2c
commit d3b62214a6

View File

@ -9,13 +9,13 @@ import org.bukkit.plugin.Plugin;
public class PluginCommandYamlParser {
@SuppressWarnings("unchecked")
public static List<Command> parse(Plugin plugin) {
List<Command> pluginCmds = new ArrayList<Command>();
Object object = plugin.getDescription().getCommands();
if (object == null)
return pluginCmds;
@SuppressWarnings("unchecked")
Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>)object;
if (map != null) {
@ -35,8 +35,12 @@ public class PluginCommandYamlParser {
if (aliases != null) {
List<String> aliasList = new ArrayList<String>();
for(String a : aliases.toString().split(",")) {
aliasList.add(a);
if (aliases instanceof List) {
for (Object o : (List<Object>)aliases) {
aliasList.add(o.toString());
}
} else {
aliasList.add(aliases.toString());
}
newCmd.setAliases(aliasList);