Search in sources :

Example 11 with Builder

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;
}
Also used : Player(org.spongepowered.api.entity.living.player.Player) Builder(org.spongepowered.api.text.Text.Builder)

Aggregations

Builder (org.spongepowered.api.text.Text.Builder)11 Player (org.spongepowered.api.entity.living.player.Player)6 MalformedURLException (java.net.MalformedURLException)4 URL (java.net.URL)4 ItemStack (org.spongepowered.api.item.inventory.ItemStack)2 World (org.spongepowered.api.world.World)2 DefineRegionBuilder (br.net.fabiozumbi12.RedProtect.Sponge.actions.DefineRegionBuilder)1 RedefineRegionBuilder (br.net.fabiozumbi12.RedProtect.Sponge.actions.RedefineRegionBuilder)1 UCChannel (br.net.fabiozumbi12.UltimateChat.Sponge.UCChannel)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 JDABuilder (jdalib.jda.core.JDABuilder)1 ClanPlayer (nl.riebie.mcclans.api.ClanPlayer)1 Command (org.cubeengine.butler.parametric.Command)1 BlockType (org.spongepowered.api.block.BlockType)1 DataContainer (org.spongepowered.api.data.DataContainer)1 DataView (org.spongepowered.api.data.DataView)1 PaginationList (org.spongepowered.api.service.pagination.PaginationList)1 Text (org.spongepowered.api.text.Text)1 TextColor (org.spongepowered.api.text.format.TextColor)1