Search in sources :

Example 6 with Rod

use of com.sx4.bot.entities.economy.item.Rod in project Sx4 by sx4-discord-bot.

the class FishingRodCommand method upgrades.

@Command(value = "upgrades", description = "View all the upgrades you can use on a fishing rod")
@CommandId(432)
@Examples({ "pickaxe upgrades" })
public void upgrades(Sx4CommandEvent event) {
    EnumSet<Upgrade> upgrades = Upgrade.getUpgrades(ItemType.ROD);
    PagedResult<Upgrade> paged = new PagedResult<>(event.getBot(), Arrays.asList(upgrades.toArray(Upgrade[]::new))).setPerPage(3).setCustomFunction(page -> {
        EmbedBuilder embed = new EmbedBuilder().setTitle("Fishing Rod 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

Sx4Command (com.sx4.bot.core.Sx4Command)6 EmbedBuilder (net.dv8tion.jda.api.EmbedBuilder)6 Command (com.jockie.bot.core.command.Command)5 CommandId (com.sx4.bot.annotations.command.CommandId)5 Examples (com.sx4.bot.annotations.command.Examples)5 Rod (com.sx4.bot.entities.economy.item.Rod)5 MessageBuilder (net.dv8tion.jda.api.MessageBuilder)4 Document (org.bson.Document)4 Bson (org.bson.conversions.Bson)4 ReturnDocument (com.mongodb.client.model.ReturnDocument)3 BotPermissions (com.sx4.bot.annotations.command.BotPermissions)3 PagedResult (com.sx4.bot.paged.PagedResult)3 Filters (com.mongodb.client.model.Filters)2 ModuleCategory (com.sx4.bot.category.ModuleCategory)2 Sx4CommandEvent (com.sx4.bot.core.Sx4CommandEvent)2 Operators (com.sx4.bot.database.mongo.model.Operators)2 CraftItem (com.sx4.bot.entities.economy.item.CraftItem)2 ItemStack (com.sx4.bot.entities.economy.item.ItemStack)2 ItemType (com.sx4.bot.entities.economy.item.ItemType)2 Upgrade (com.sx4.bot.entities.economy.upgrade.Upgrade)2