mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-19 06:42:02 +01:00
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:
parent
7bfb006b2c
commit
d3b62214a6
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user