mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-16 20:53:54 -07:00
General cleanup (deprecated+whitespace)
By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
@@ -8,40 +8,40 @@ import java.util.Map.Entry;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class PluginCommandYamlParser {
|
||||
|
||||
|
||||
public static List<Command> parse(Plugin plugin) {
|
||||
List<Command> pluginCmds = new ArrayList<Command>();
|
||||
Object object = plugin.getDescription().getCommands();
|
||||
if (object == null)
|
||||
return pluginCmds;
|
||||
|
||||
return pluginCmds;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>)object;
|
||||
|
||||
if (map != null) {
|
||||
for(Entry<String, Map<String, Object>> entry : map.entrySet()) {
|
||||
Command newCmd = new PluginCommand(entry.getKey(),plugin);
|
||||
Command newCmd = new PluginCommand(entry.getKey(),plugin);
|
||||
Object description = entry.getValue().get("description");
|
||||
Object usage = entry.getValue().get("usage");
|
||||
Object aliases = entry.getValue().get("aliases");
|
||||
|
||||
|
||||
if (description != null)
|
||||
newCmd.setTooltip(description.toString());
|
||||
|
||||
if (usage != null) {
|
||||
newCmd.setUsage(usage.toString());
|
||||
}
|
||||
|
||||
|
||||
if (aliases != null) {
|
||||
List<String> aliasList = new ArrayList<String>();
|
||||
|
||||
|
||||
for(String a : aliases.toString().split(",")) {
|
||||
aliasList.add(a);
|
||||
}
|
||||
|
||||
|
||||
newCmd.setAliases(aliasList);
|
||||
}
|
||||
|
||||
|
||||
pluginCmds.add(newCmd);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user