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");
}
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)));
}
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);
}
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);
}
});
}
}
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();
}
Aggregations