Search in sources :

Example 1 with EventUserService

use of gg.projecteden.nexus.models.eventuser.EventUserService in project Nexus by ProjectEdenGG.

the class EmojisCommand method buy.

@Path("buy <emoji>")
void buy(Emoji emoji) {
    if (user.owns(emoji))
        error("You already own &e" + emoji.getName() + " &f" + emoji.getEmoji());
    new EventUserService().edit(player(), eventUser -> eventUser.charge(EventStoreItem.CHAT_EMOJIS.getPrice()));
    user.give(emoji);
    service.save(user);
    send(PREFIX + "Purchased &e" + emoji.getName() + " &f" + emoji.getEmoji() + "&3, use with &c/emoji picker");
}
Also used : EventUserService(gg.projecteden.nexus.models.eventuser.EventUserService) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path)

Example 2 with EventUserService

use of gg.projecteden.nexus.models.eventuser.EventUserService in project Nexus by ProjectEdenGG.

the class BearFair21StatsCommand method stats.

@Path
void stats() {
    List<BearFair21User> users = userService.getAll();
    EventUserService eventUserService = new EventUserService();
    List<EventUser> eventUsers = eventUserService.getAll();
    // Total time played
    // % of time spent at bf vs other worlds
    // % of people who logged in that visited bf
    // % of playtime per world during bf
    send("&6&lUnique visitors: &e" + users.stream().filter(bearFair21User -> !bearFair21User.isFirstVisit()).count());
    line();
    send("&6&lQuest Stages");
    send(json("- Main").hover(getQuestStages(users, BearFair21UserQuestStageHelper.MAIN)));
    send(json("  - LumberJack").hover(getQuestStages(users, BearFair21UserQuestStageHelper.LUMBERJACK)));
    send(json("  - BeeKeeper").hover(getQuestStages(users, BearFair21UserQuestStageHelper.BEEKEEPER)));
    send(json("  - Recycler").hover(getQuestStages(users, BearFair21UserQuestStageHelper.RECYCLER)));
    send(json("- Minigame Night").hover(getQuestStages(users, BearFair21UserQuestStageHelper.MINIGAME_NIGHT)));
    send(json("- Pugmas").hover(getQuestStages(users, BearFair21UserQuestStageHelper.PUGMAS)));
    send(json("- Halloween").hover(getQuestStages(users, BearFair21UserQuestStageHelper.HALLOWEEN)));
    send(json("- Summer Down Under").hover(getQuestStages(users, BearFair21UserQuestStageHelper.SUMMER_DOWN_UNDER)));
    line();
    send("&6&lEvent Participation");
    for (String event : eventParticipation.keySet()) send(" - " + event + ": " + eventParticipation.get(event).size());
    line();
    send("&6&lDaily Points");
    for (Day day : Day.values()) send(json(" - Day " + (day.ordinal() + 1)).hover(getCompletedSources(eventUsers, day)));
    line();
    send("&6&lTreasure Chests");
    Map<Integer, Integer> data = getTreasureChestData(users);
    send(json("- Found all: " + data.get(20)));
    send(json("- Found some: " + getFoundSomeTreasureChests(data)).hover(getTreasureChestStats(data)));
    send(json("- Found none: " + data.get(0)));
}
Also used : StringUtils(gg.projecteden.nexus.utils.StringUtils) Getter(lombok.Getter) EventUserService(gg.projecteden.nexus.models.eventuser.EventUserService) HashMap(java.util.HashMap) BearFair21User(gg.projecteden.nexus.models.bearfair21.BearFair21User) ArrayList(java.util.ArrayList) BearFair21UserService(gg.projecteden.nexus.models.bearfair21.BearFair21UserService) EventUser(gg.projecteden.nexus.models.eventuser.EventUser) QuestStage(gg.projecteden.nexus.features.events.models.QuestStage) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) BF21PointSource(gg.projecteden.nexus.features.events.y2021.bearfair21.BearFair21.BF21PointSource) Map(java.util.Map) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) BearFair21(gg.projecteden.nexus.features.events.y2021.bearfair21.BearFair21) CustomCommand(gg.projecteden.nexus.framework.commands.models.CustomCommand) Aliases(gg.projecteden.nexus.framework.commands.models.annotations.Aliases) List(java.util.List) CommandEvent(gg.projecteden.nexus.framework.commands.models.events.CommandEvent) BearFair21UserQuestStageHelper(gg.projecteden.nexus.features.events.y2021.bearfair21.commands.BearFair21Command.BearFair21UserQuestStageHelper) LocalDate(java.time.LocalDate) Utils(gg.projecteden.utils.Utils) AllArgsConstructor(lombok.AllArgsConstructor) NotNull(org.jetbrains.annotations.NotNull) Comparator(java.util.Comparator) Disabled(gg.projecteden.annotations.Disabled) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) EventUser(gg.projecteden.nexus.models.eventuser.EventUser) BearFair21User(gg.projecteden.nexus.models.bearfair21.BearFair21User) EventUserService(gg.projecteden.nexus.models.eventuser.EventUserService) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path)

Example 3 with EventUserService

use of gg.projecteden.nexus.models.eventuser.EventUserService in project Nexus by ProjectEdenGG.

the class Pugmas20 method checkDailyTokens.

public static int checkDailyTokens(HasUniqueId player, String id, int amount) {
    EventUserService service = new EventUserService();
    EventUser user = service.get(player);
    return user.getDailyTokensLeft(("pugmas20_" + id).toLowerCase(), amount, tokenMaxes);
}
Also used : EventUser(gg.projecteden.nexus.models.eventuser.EventUser) EventUserService(gg.projecteden.nexus.models.eventuser.EventUserService)

Example 4 with EventUserService

use of gg.projecteden.nexus.models.eventuser.EventUserService in project Nexus by ProjectEdenGG.

the class Quests method onRightClickNPC.

@EventHandler
public void onRightClickNPC(NPCRightClickEvent event) {
    Player player = event.getClicker();
    if (event.getNPC().getId() != PARADE_MANAGER.getNpcId())
        return;
    CooldownService cooldownService = new CooldownService();
    if (!cooldownService.check(player, "Pride21_NPCInteract", TimeUtils.TickTime.SECOND.x(5)))
        return;
    int waitTicks = Talker.sendScript(player, PARADE_MANAGER);
    Pride21User user = service.get(player);
    if (user.isComplete()) {
        Tasks.wait(waitTicks, () -> player.teleportAsync(player.getLocation()));
        Tasks.waitAsync(waitTicks, () -> {
            player.resetPlayerTime();
            viewFloat(player, true);
            if (false && !user.isBonusTokenRewardClaimed()) {
                Trophy.PRIDE_2021.give(player);
                user.setBonusTokenRewardClaimed(true);
                service.save(user);
                EventUserService eventUserService = new EventUserService();
                EventUser eventUser = eventUserService.get(user);
                eventUser.giveTokens(50);
                eventUserService.save(eventUser);
                ItemStack dyeBomb = DyeBombCommand.getDyeBomb();
                dyeBomb.setAmount(16);
                PlayerUtils.giveItemAndMailExcess(player, dyeBomb, "Pride 2021 Reward", WorldGroup.SURVIVAL);
            }
        });
    }
}
Also used : Player(org.bukkit.entity.Player) Pride21User(gg.projecteden.nexus.models.pride21.Pride21User) EventUser(gg.projecteden.nexus.models.eventuser.EventUser) CooldownService(gg.projecteden.nexus.models.cooldown.CooldownService) ItemStack(org.bukkit.inventory.ItemStack) EventUserService(gg.projecteden.nexus.models.eventuser.EventUserService) EventHandler(org.bukkit.event.EventHandler)

Example 5 with EventUserService

use of gg.projecteden.nexus.models.eventuser.EventUserService in project Nexus by ProjectEdenGG.

the class BankCommand method wallet.

@Path("[player]")
@Description("Displays all currencies owned by the player")
void wallet(@Arg("self") Nerd nerd) {
    send(PREFIX + "&e" + nerd.getNickname() + "&3's Wallet: ");
    // Store Credit
    Contributor contributor = new ContributorService().get(nerd);
    send("&3Store Credit: &e" + contributor.getCreditFormatted());
    // Vote Points
    Voter voter = new VoterService().get(nerd);
    send("&3Vote Points: &e" + voter.getPoints());
    // Event Store
    EventUser eventUser = new EventUserService().get(nerd);
    send("&3Event Tokens: &e" + eventUser.getTokens());
    // Minigames
    PerkOwner perkOwner = new PerkOwnerService().get(nerd);
    send("&3Minigame Tokens: &e" + perkOwner.getTokens());
    // Economy
    send("&3Economy Balances: &e");
    Banker banker = new BankerService().get(nerd);
    Map<ShopGroup, BigDecimal> balances = banker.getBalances();
    for (ShopGroup shopGroup : balances.keySet()) {
        String name = StringUtils.camelCase(shopGroup);
        String bal = banker.getBalanceFormatted(shopGroup);
        send("&3 - " + name + ": &e" + bal);
    }
    line();
}
Also used : PerkOwner(gg.projecteden.nexus.models.perkowner.PerkOwner) Banker(gg.projecteden.nexus.models.banker.Banker) Contributor(gg.projecteden.nexus.models.store.Contributor) VoterService(gg.projecteden.nexus.models.voter.VoterService) BigDecimal(java.math.BigDecimal) PerkOwnerService(gg.projecteden.nexus.models.perkowner.PerkOwnerService) ShopGroup(gg.projecteden.nexus.models.shop.Shop.ShopGroup) ContributorService(gg.projecteden.nexus.models.store.ContributorService) EventUser(gg.projecteden.nexus.models.eventuser.EventUser) Voter(gg.projecteden.nexus.models.voter.Voter) BankerService(gg.projecteden.nexus.models.banker.BankerService) EventUserService(gg.projecteden.nexus.models.eventuser.EventUserService) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description)

Aggregations

EventUserService (gg.projecteden.nexus.models.eventuser.EventUserService)9 EventUser (gg.projecteden.nexus.models.eventuser.EventUser)6 Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)4 Player (org.bukkit.entity.Player)3 EventHandler (org.bukkit.event.EventHandler)3 SoundBuilder (gg.projecteden.nexus.utils.SoundBuilder)2 Location (org.bukkit.Location)2 Block (org.bukkit.block.Block)2 ParticleBuilder (com.destroystokyo.paper.ParticleBuilder)1 ProtectedRegion (com.sk89q.worldguard.protection.regions.ProtectedRegion)1 Disabled (gg.projecteden.annotations.Disabled)1 QuestStage (gg.projecteden.nexus.features.events.models.QuestStage)1 BearFair21 (gg.projecteden.nexus.features.events.y2021.bearfair21.BearFair21)1 BF21PointSource (gg.projecteden.nexus.features.events.y2021.bearfair21.BearFair21.BF21PointSource)1 BearFair21UserQuestStageHelper (gg.projecteden.nexus.features.events.y2021.bearfair21.commands.BearFair21Command.BearFair21UserQuestStageHelper)1 CustomCommand (gg.projecteden.nexus.framework.commands.models.CustomCommand)1 Aliases (gg.projecteden.nexus.framework.commands.models.annotations.Aliases)1 Confirm (gg.projecteden.nexus.framework.commands.models.annotations.Confirm)1 Description (gg.projecteden.nexus.framework.commands.models.annotations.Description)1 CommandEvent (gg.projecteden.nexus.framework.commands.models.events.CommandEvent)1