Search in sources :

Example 1 with OreType

use of gg.projecteden.nexus.features.events.y2020.pugmas20.quests.TheMines.OreType in project Nexus by ProjectEdenGG.

the class Pugmas20Command method getIngotsLeft.

private int getIngotsLeft(Pugmas20User user, List<TradeBuilder> trades, OreType oreType) {
    Optional<Integer> amount = trades.stream().map(tradeBuilder -> tradeBuilder.getIngredients().iterator().next()).filter(ingredient -> ingredient.getType() == oreType.getIngot().getType()).map(ItemStack::getAmount).findFirst();
    int tokensLeft = Math.abs(Pugmas20.checkDailyTokens(user, "themines_" + oreType.name(), 0));
    int perToken = amount.orElse(0);
    return tokensLeft * perToken;
}
Also used : ProtectedRegion(com.sk89q.worldguard.protection.regions.ProtectedRegion) AdventChest(gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest) Pugmas20QuestStageHelper(gg.projecteden.nexus.features.events.y2020.pugmas20.quests.Quests.Pugmas20QuestStageHelper) TabCompleteIgnore(gg.projecteden.nexus.framework.commands.models.annotations.TabCompleteIgnore) LightTheTree(gg.projecteden.nexus.features.events.y2020.pugmas20.quests.LightTheTree) Pugmas20.isSecondChance(gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.isSecondChance) PlayerUtils(gg.projecteden.nexus.utils.PlayerUtils) EventUser(gg.projecteden.nexus.models.eventuser.EventUser) QuestStage(gg.projecteden.nexus.features.events.models.QuestStage) AdventMenu(gg.projecteden.nexus.features.events.y2020.pugmas20.menu.AdventMenu) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission) Pugmas20.showWaypoint(gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.showWaypoint) Timespan(gg.projecteden.utils.TimeUtils.Timespan) Material(org.bukkit.Material) QuestNPC.getUnplayedToysList(gg.projecteden.nexus.features.events.y2020.pugmas20.models.QuestNPC.getUnplayedToysList) Env(gg.projecteden.utils.Env) Bukkit(org.bukkit.Bukkit) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) OreType(gg.projecteden.nexus.features.events.y2020.pugmas20.quests.TheMines.OreType) OrnamentVendor(gg.projecteden.nexus.features.events.y2020.pugmas20.quests.OrnamentVendor) Set(java.util.Set) HideFromHelp(gg.projecteden.nexus.framework.commands.models.annotations.HideFromHelp) Collectors(java.util.stream.Collectors) ItemStack(org.bukkit.inventory.ItemStack) List(java.util.List) TradeBuilder(gg.projecteden.nexus.utils.MerchantBuilder.TradeBuilder) LocalDate(java.time.LocalDate) Optional(java.util.Optional) Pugmas20.isPastPugmas(gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.isPastPugmas) TheMines(gg.projecteden.nexus.features.events.y2020.pugmas20.quests.TheMines) JsonBuilder(gg.projecteden.nexus.utils.JsonBuilder) EventUserService(gg.projecteden.nexus.models.eventuser.EventUserService) PugmasTreeType(gg.projecteden.nexus.features.events.y2020.pugmas20.quests.OrnamentVendor.PugmasTreeType) Arg(gg.projecteden.nexus.framework.commands.models.annotations.Arg) HashMap(java.util.HashMap) Group(gg.projecteden.nexus.framework.commands.models.annotations.Permission.Group) MerchantNPC(gg.projecteden.nexus.features.events.y2020.pugmas20.models.Merchants.MerchantNPC) ArrayList(java.util.ArrayList) Environments(gg.projecteden.annotations.Environments) Ornament(gg.projecteden.nexus.features.events.y2020.pugmas20.quests.OrnamentVendor.Ornament) Pugmas20User(gg.projecteden.nexus.models.pugmas20.Pugmas20User) Train(gg.projecteden.nexus.features.events.y2020.pugmas20.Train) Pugmas20UserService(gg.projecteden.nexus.models.pugmas20.Pugmas20UserService) Listener(org.bukkit.event.Listener) TeleportCause(org.bukkit.event.player.PlayerTeleportEvent.TeleportCause) Pugmas20(gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20) ToyTesting(gg.projecteden.nexus.features.events.y2020.pugmas20.quests.ToyTesting) CustomCommand(gg.projecteden.nexus.framework.commands.models.CustomCommand) District(gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest.District) CommandEvent(gg.projecteden.nexus.framework.commands.models.events.CommandEvent) Pugmas20.isBeforePugmas(gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.isBeforePugmas) AdventProvider(gg.projecteden.nexus.features.events.y2020.pugmas20.menu.providers.AdventProvider) Pugmas20Quest(gg.projecteden.nexus.features.events.y2020.pugmas20.quests.Quests.Pugmas20Quest) AdventChests(gg.projecteden.nexus.features.events.y2020.pugmas20.AdventChests) Disabled(gg.projecteden.annotations.Disabled) NoArgsConstructor(lombok.NoArgsConstructor) Pugmas20.showWaypoint(gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.showWaypoint)

Example 2 with OreType

use of gg.projecteden.nexus.features.events.y2020.pugmas20.quests.TheMines.OreType in project Nexus by ProjectEdenGG.

the class Pugmas20Command method getIngotTradesLeft.

private List<String> getIngotTradesLeft(Pugmas20User user) {
    List<String> tradesLeft = new ArrayList<>();
    List<TradeBuilder> trades = MerchantNPC.THEMINES_SELLCRATE.getTrades(user);
    for (OreType oreType : OreType.values()) {
        int ingotsLeft = getIngotsLeft(user, trades, oreType);
        if (ingotsLeft > 0)
            tradesLeft.add("&e" + ingotsLeft + " &f" + camelCase(oreType));
    }
    return tradesLeft;
}
Also used : OreType(gg.projecteden.nexus.features.events.y2020.pugmas20.quests.TheMines.OreType) TradeBuilder(gg.projecteden.nexus.utils.MerchantBuilder.TradeBuilder) ArrayList(java.util.ArrayList) Pugmas20.showWaypoint(gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.showWaypoint)

Aggregations

Pugmas20.showWaypoint (gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.showWaypoint)2 OreType (gg.projecteden.nexus.features.events.y2020.pugmas20.quests.TheMines.OreType)2 ProtectedRegion (com.sk89q.worldguard.protection.regions.ProtectedRegion)1 Disabled (gg.projecteden.annotations.Disabled)1 Environments (gg.projecteden.annotations.Environments)1 QuestStage (gg.projecteden.nexus.features.events.models.QuestStage)1 AdventChests (gg.projecteden.nexus.features.events.y2020.pugmas20.AdventChests)1 Pugmas20 (gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20)1 Pugmas20.isBeforePugmas (gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.isBeforePugmas)1 Pugmas20.isPastPugmas (gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.isPastPugmas)1 Pugmas20.isSecondChance (gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.isSecondChance)1 Train (gg.projecteden.nexus.features.events.y2020.pugmas20.Train)1 AdventMenu (gg.projecteden.nexus.features.events.y2020.pugmas20.menu.AdventMenu)1 AdventProvider (gg.projecteden.nexus.features.events.y2020.pugmas20.menu.providers.AdventProvider)1 AdventChest (gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest)1 District (gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest.District)1 MerchantNPC (gg.projecteden.nexus.features.events.y2020.pugmas20.models.Merchants.MerchantNPC)1 QuestNPC.getUnplayedToysList (gg.projecteden.nexus.features.events.y2020.pugmas20.models.QuestNPC.getUnplayedToysList)1 LightTheTree (gg.projecteden.nexus.features.events.y2020.pugmas20.quests.LightTheTree)1 OrnamentVendor (gg.projecteden.nexus.features.events.y2020.pugmas20.quests.OrnamentVendor)1