use of gg.projecteden.nexus.models.eventuser.EventUser 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.EventUser 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.EventUser in project Nexus by ProjectEdenGG.
the class EventsCommand method tokens_pay.
/* TODO
@Path("tokens daily [player]")
void tokensDaily(@Arg("self") EventUser user) {
if (isSelf(user))
send(PREFIX + "&3Daily tokens:");
else
send(PREFIX + "&3" + user.getOfflinePlayer().getName() + "'s Daily tokens:");
for (BFtokensource tokensource : BFtokensource.values()) {
Map<LocalDate, Integer> dailyMap = user.getTokensReceivedToday().get(tokensource);
int tokens = 0;
if (dailyMap != null)
tokens = dailyMap.getOrDefault(LocalDate.now(), 0);
int dailyMax = EventUser.DAILY_SOURCE_MAX;
String sourceColor = tokens == dailyMax ? "&a" : "&3";
String sourceName = StringUtils.camelCase(tokensource.name());
send(" " + sourceColor + sourceName + " &7- &e" + tokens + "&3/&e" + dailyMax);
}
}
*/
@Path("tokens pay <player> <tokens>")
void tokens_pay(EventUser toUser, int tokens) {
EventUser fromUser = service.get(player());
if (isSelf(toUser))
error("You cannot pay yourself");
fromUser.takeTokens(tokens);
toUser.giveTokens(tokens);
fromUser.sendMessage(PREFIX + "&e" + tokens + " event tokens &3have been sent to &e" + toUser.getNickname());
toUser.sendMessage(PREFIX + "&e" + tokens + " event tokens &3have been received from &e" + fromUser.getNickname());
service.save(fromUser);
service.save(toUser);
}
use of gg.projecteden.nexus.models.eventuser.EventUser in project Nexus by ProjectEdenGG.
the class BuyFlagsMenu method purchase.
private void purchase(Flags flag, Player player, boolean bunting) {
ItemStack item = bunting ? flag.getBunting() : flag.getFlag();
Pride21User user = service.get(player);
EventUser eventUser = eventService.get(player);
if (user.claimReward()) {
/* this method removes tokens and saves for us so we don't need to do anything here */
} else if (eventUser.getTokens() >= COST) {
eventUser.takeTokens(COST);
eventService.save(eventUser);
} else {
player.sendMessage(JsonBuilder.fromPrefix(Pride21.PREFIX).next("&cYou don't have enough event tokens to purchase this item"));
new SoundBuilder(Sound.ENTITY_VILLAGER_NO).receiver(player).category(SoundCategory.VOICE).volume(0.8f).play();
return;
}
PlayerUtils.giveItemAndMailExcess(player, item, "Pride 2021 Purchase", WorldGroup.SURVIVAL);
open(player);
}
use of gg.projecteden.nexus.models.eventuser.EventUser 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