Search in sources :

Example 6 with Pickaxe

use of com.sx4.bot.entities.economy.item.Pickaxe 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)

Example 7 with Pickaxe

use of com.sx4.bot.entities.economy.item.Pickaxe 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)

Example 8 with Pickaxe

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

the class PickaxeCommand method shop.

@Command(value = "shop", description = "View all the pickaxes you are able to buy or craft")
@CommandId(360)
@Examples({ "pickaxe shop" })
@BotPermissions(permissions = { Permission.MESSAGE_EMBED_LINKS })
public void shop(Sx4CommandEvent event) {
    List<Pickaxe> pickaxes = event.getBot().getEconomyManager().getItems(Pickaxe.class);
    PagedResult<Pickaxe> paged = new PagedResult<>(event.getBot(), pickaxes).setPerPage(12).setCustomFunction(page -> {
        EmbedBuilder embed = new EmbedBuilder().setAuthor("Pickaxe Shop", null, event.getSelfUser().getEffectiveAvatarUrl()).setTitle("Page " + page.getPage() + "/" + page.getMaxPage()).setDescription("Pickaxes are a good way to gain some extra money aswell as some materials").setFooter(PagedResult.DEFAULT_FOOTER_TEXT);
        page.forEach((pickaxe, index) -> {
            List<ItemStack<CraftItem>> items = pickaxe.getCraft();
            String craft = items.isEmpty() ? "None" : items.stream().map(ItemStack::toString).collect(Collectors.joining("\n"));
            embed.addField(pickaxe.getName(), String.format("Price: $%,d\nCraft: %s\nDurability: %,d", pickaxe.getPrice(), craft, pickaxe.getMaxDurability()), true);
        });
        return new MessageBuilder().setEmbeds(embed.build());
    });
    paged.execute(event);
}
Also used : EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) MessageBuilder(net.dv8tion.jda.api.MessageBuilder) Pickaxe(com.sx4.bot.entities.economy.item.Pickaxe) ItemStack(com.sx4.bot.entities.economy.item.ItemStack) PagedResult(com.sx4.bot.paged.PagedResult) BotPermissions(com.sx4.bot.annotations.command.BotPermissions) 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)8 EmbedBuilder (net.dv8tion.jda.api.EmbedBuilder)8 Command (com.jockie.bot.core.command.Command)7 CommandId (com.sx4.bot.annotations.command.CommandId)7 Examples (com.sx4.bot.annotations.command.Examples)7 PagedResult (com.sx4.bot.paged.PagedResult)6 MessageBuilder (net.dv8tion.jda.api.MessageBuilder)6 Upgrade (com.sx4.bot.entities.economy.upgrade.Upgrade)5 BotPermissions (com.sx4.bot.annotations.command.BotPermissions)4 Pickaxe (com.sx4.bot.entities.economy.item.Pickaxe)4 Document (org.bson.Document)4 Bson (org.bson.conversions.Bson)4 ModuleCategory (com.sx4.bot.category.ModuleCategory)3 Sx4CommandEvent (com.sx4.bot.core.Sx4CommandEvent)3 Operators (com.sx4.bot.database.mongo.model.Operators)3 ItemStack (com.sx4.bot.entities.economy.item.ItemStack)3 EconomyUtility (com.sx4.bot.utility.EconomyUtility)3 ExceptionUtility (com.sx4.bot.utility.ExceptionUtility)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3