use of net.md_5.bungee.api.chat.TextComponent in project VotingPlugin by Ben12345rocks.
the class VoteHelp method helpText.
public ArrayList<TextComponent> helpText(CommandSender sender) {
ArrayList<TextComponent> msg = new ArrayList<TextComponent>();
HashMap<String, TextComponent> unsorted = new HashMap<String, TextComponent>();
boolean requirePerms = plugin.getConfigFile().getFormatCommandsVoteHelpRequirePermission();
String colorStr = plugin.getConfigFile().getFormatCommandsVoteHelpHoverColor();
ChatColor hoverColor = null;
try {
hoverColor = ChatColor.of(colorStr);
} catch (Exception e) {
plugin.getLogger().warning("Failed to get color for hover help message");
e.printStackTrace();
hoverColor = ChatColor.AQUA;
}
for (CommandHandler cmdHandle : plugin.getVoteCommand()) {
if (!requirePerms || cmdHandle.hasPerm(sender)) {
unsorted.put(cmdHandle.getHelpLineCommand("/vote"), cmdHandle.getHelpLine("/vote", plugin.getConfigFile().getFormatCommandsVoteHelpLine(), hoverColor));
}
}
ArrayList<String> unsortedList = new ArrayList<String>();
unsortedList.addAll(unsorted.keySet());
Collections.sort(unsortedList, String.CASE_INSENSITIVE_ORDER);
for (String cmd : unsortedList) {
msg.add(unsorted.get(cmd));
}
return msg;
}
Aggregations