Search in sources :

Example 6 with Upgrade

use of com.sx4.bot.entities.economy.upgrade.Upgrade in project Sx4 by sx4-discord-bot.

the class AxeCommand method upgrades.

@Command(value = "upgrades", description = "View all the upgrades you can use on a axe")
@CommandId(430)
@Examples({ "pickaxe upgrades" })
public void upgrades(Sx4CommandEvent event) {
    EnumSet<Upgrade> upgrades = Upgrade.getUpgrades(ItemType.AXE);
    PagedResult<Upgrade> paged = new PagedResult<>(event.getBot(), Arrays.asList(upgrades.toArray(Upgrade[]::new))).setPerPage(3).setCustomFunction(page -> {
        EmbedBuilder embed = new EmbedBuilder().setTitle("Axe Upgrades");
        page.forEach((upgrade, index) -> embed.addField(upgrade.getName(), upgrade.getDescription(), false));
        return new MessageBuilder().setEmbeds(embed.build());
    });
    paged.execute(event);
}
Also used : EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) MessageBuilder(net.dv8tion.jda.api.MessageBuilder) Upgrade(com.sx4.bot.entities.economy.upgrade.Upgrade) PagedResult(com.sx4.bot.paged.PagedResult) Command(com.jockie.bot.core.command.Command) Sx4Command(com.sx4.bot.core.Sx4Command) CommandId(com.sx4.bot.annotations.command.CommandId) Examples(com.sx4.bot.annotations.command.Examples)

Aggregations

Command (com.jockie.bot.core.command.Command)6 CommandId (com.sx4.bot.annotations.command.CommandId)6 Examples (com.sx4.bot.annotations.command.Examples)6 Sx4Command (com.sx4.bot.core.Sx4Command)6 Upgrade (com.sx4.bot.entities.economy.upgrade.Upgrade)6 PagedResult (com.sx4.bot.paged.PagedResult)6 EmbedBuilder (net.dv8tion.jda.api.EmbedBuilder)6 MessageBuilder (net.dv8tion.jda.api.MessageBuilder)6 Argument (com.jockie.bot.core.argument.Argument)3 com.mongodb.client.model (com.mongodb.client.model)3 UpdateResult (com.mongodb.client.result.UpdateResult)3 AlternativeOptions (com.sx4.bot.annotations.argument.AlternativeOptions)3 DefaultNumber (com.sx4.bot.annotations.argument.DefaultNumber)3 Limit (com.sx4.bot.annotations.argument.Limit)3 BotPermissions (com.sx4.bot.annotations.command.BotPermissions)3 ModuleCategory (com.sx4.bot.category.ModuleCategory)3 Sx4CommandEvent (com.sx4.bot.core.Sx4CommandEvent)3 Operators (com.sx4.bot.database.mongo.model.Operators)3 Alternative (com.sx4.bot.entities.argument.Alternative)3 CraftItem (com.sx4.bot.entities.economy.item.CraftItem)3