use of org.spongepowered.api.text.Text.Builder in project UltimateChat by FabioZumbi12.
the class UCCommands method getHelpChannel.
private Builder getHelpChannel(CommandSource p) {
Builder fancy = Text.builder();
fancy.append(UCUtil.toText("&7------------------------------------------\n"));
fancy.append(UCUtil.toText(UChat.get().getLang().get("help.channels.available").replace("{channels}", "") + " "));
boolean first = true;
for (UCChannel ch : UChat.get().getChannels().values()) {
if (!(p instanceof Player) || UChat.get().getPerms().channelWritePerm(p, ch) && ch.availableInWorld(((Player) p).getWorld())) {
Builder fancych = Text.builder();
if (first) {
fancych.append(UCUtil.toText(" " + ch.getColor() + ch.getName()));
first = false;
} else {
fancych.append(UCUtil.toText("&a, " + ch.getColor() + ch.getName()));
}
fancych.onHover(TextActions.showText(UCUtil.toText(ch.getColor() + "Alias: " + ch.getAlias())));
fancych.onClick(TextActions.runCommand("/" + ch.getAlias()));
fancych.applyTo(fancy);
}
}
fancy.append(UCUtil.toText("\n&7------------------------------------------ "));
if (UChat.get().getPerms().hasPerm(p, "admin")) {
String jarversion = UChat.get().instance().getSource().get().toFile().getName();
fancy.append(UCUtil.toText("\n&8&o- UChat full version: " + jarversion));
}
return fancy;
}
Aggregations