Search in sources :

Example 11 with Description

use of gg.projecteden.nexus.framework.commands.models.annotations.Description in project Nexus by ProjectEdenGG.

the class HoursCommand method top2.

// TODO Update paginate to support database-level pagination
@Async
@Description("View the play time leaderboard for any year, month, or day")
@Path("top [args...]")
void top2(@Arg("1") HoursTopArguments args, @Switch boolean onlyStaff) {
    int page = args.getPage();
    List<PageResult> results = service.getPage(args);
    String onlyStaffSwitch = "";
    if (onlyStaff) {
        onlyStaffSwitch = " --onlyStaff";
        results.removeIf(result -> !Rank.of(result.getUuid()).isStaff());
    }
    if (results.size() == 0)
        error("&cNo results on page " + page);
    int totalHours = 0;
    for (PageResult result : results) totalHours += result.getTotal();
    send("");
    send(PREFIX + "Total: " + Timespan.ofSeconds(totalHours).format() + (page > 1 ? "&e  |  &3Page " + page : ""));
    BiFunction<PageResult, String, JsonBuilder> formatter = (result, index) -> json(index + " &e" + Nerd.of(result.getUuid()).getColoredName() + " &7- " + Timespan.ofSeconds(result.getTotal()).format());
    paginate(results, formatter, "/hours top " + args.getInput() + onlyStaffSwitch, page);
}
Also used : JsonBuilder(gg.projecteden.nexus.utils.JsonBuilder) JsonBuilder(gg.projecteden.nexus.utils.JsonBuilder) BiFunction(java.util.function.BiFunction) Async(gg.projecteden.annotations.Async) Arg(gg.projecteden.nexus.framework.commands.models.annotations.Arg) ConverterFor(gg.projecteden.nexus.framework.commands.models.annotations.ConverterFor) Player(org.bukkit.entity.Player) AFK(gg.projecteden.nexus.features.afk.AFK) ArrayList(java.util.ArrayList) Hours(gg.projecteden.nexus.models.hours.Hours) HashSet(java.util.HashSet) PlayerUtils(gg.projecteden.nexus.utils.PlayerUtils) Nickname(gg.projecteden.nexus.models.nickname.Nickname) TimespanBuilder(gg.projecteden.utils.TimeUtils.Timespan.TimespanBuilder) Timespan(gg.projecteden.utils.TimeUtils.Timespan) Nexus(gg.projecteden.nexus.Nexus) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Nerd(gg.projecteden.nexus.models.nerd.Nerd) Rank(gg.projecteden.nexus.models.nerd.Rank) Koda(gg.projecteden.nexus.features.chat.Koda) CustomCommand(gg.projecteden.nexus.framework.commands.models.CustomCommand) Tasks(gg.projecteden.nexus.utils.Tasks) Set(java.util.Set) GroupChange(gg.projecteden.nexus.utils.LuckPermsUtils.GroupChange) Collectors(java.util.stream.Collectors) Aliases(gg.projecteden.nexus.framework.commands.models.annotations.Aliases) TickTime(gg.projecteden.utils.TimeUtils.TickTime) Switch(gg.projecteden.nexus.framework.commands.models.annotations.Switch) HoursTopArguments(gg.projecteden.nexus.models.hours.HoursService.HoursTopArguments) List(java.util.List) Jingle(gg.projecteden.nexus.utils.SoundUtils.Jingle) CommandEvent(gg.projecteden.nexus.framework.commands.models.events.CommandEvent) LocalDate(java.time.LocalDate) HoursService(gg.projecteden.nexus.models.hours.HoursService) TabCompleterFor(gg.projecteden.nexus.framework.commands.models.annotations.TabCompleterFor) OnlinePlayers(gg.projecteden.nexus.utils.PlayerUtils.OnlinePlayers) PageResult(gg.projecteden.nexus.models.hours.HoursService.PageResult) PageResult(gg.projecteden.nexus.models.hours.HoursService.PageResult) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description) Async(gg.projecteden.annotations.Async)

Example 12 with Description

use of gg.projecteden.nexus.framework.commands.models.annotations.Description in project Nexus by ProjectEdenGG.

the class ModReviewCommand method request.

@Cooldown(value = TickTime.SECOND, x = 30)
@Path("request <name> [notes...]")
@Description("Request a mod to be reviewed by the staff team")
void request(String name, String notes) {
    ModReviewRequest request = new ModReviewRequest(uuid(), name, notes);
    modReview.request(request);
    save();
    send(PREFIX + "Requested mod &e" + name + " &3to be reviewed");
    String message = "&e" + name() + " &3has requested mod &e" + name + " &3to be reviewed";
    Broadcast.staff().prefix("ModReview").message(json(message).command("/modreview requests")).send();
}
Also used : ModReviewRequest(gg.projecteden.nexus.models.modreview.ModReview.ModReviewRequest) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description) Cooldown(gg.projecteden.nexus.framework.commands.models.annotations.Cooldown)

Example 13 with Description

use of gg.projecteden.nexus.framework.commands.models.annotations.Description 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)

Example 14 with Description

use of gg.projecteden.nexus.framework.commands.models.annotations.Description in project Nexus by ProjectEdenGG.

the class Pugmas20Command method advent.

@Path("advent")
@Description("Open the Advent menu")
void advent() {
    LocalDate now = LocalDate.now();
    if (!isAdmin()) {
        if (isBeforePugmas(now))
            error("Soon™ (" + timeLeft + ")");
        if (isPastPugmas(now))
            error("Next year!");
        if (isSecondChance(now))
            now = now.withYear(2020).withMonth(12).withDayOfMonth(25);
    }
    AdventMenu.openAdvent(player(), now);
}
Also used : LocalDate(java.time.LocalDate) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description)

Example 15 with Description

use of gg.projecteden.nexus.framework.commands.models.annotations.Description in project Nexus by ProjectEdenGG.

the class Pugmas20Command method waypoint.

@Path("waypoint <day>")
@Description("Get directions to a chest you have already found")
void waypoint(int day) {
    if (!pugmasUser.getLocatedDays().contains(day))
        error("You have not located that chest yet");
    AdventChest adventChest = AdventChests.getAdventChest(day);
    if (adventChest == null)
        error("Advent chest is null");
    showWaypoint(adventChest, player());
}
Also used : AdventChest(gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description)

Aggregations

Description (gg.projecteden.nexus.framework.commands.models.annotations.Description)22 Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)21 Permission (gg.projecteden.nexus.framework.commands.models.annotations.Permission)7 LocalDate (java.time.LocalDate)5 JsonBuilder (gg.projecteden.nexus.utils.JsonBuilder)4 ItemStack (org.bukkit.inventory.ItemStack)4 RadioUtils.getListenedRadio (gg.projecteden.nexus.features.radio.RadioUtils.getListenedRadio)3 RadioUtils.isInRangeOfRadiusRadio (gg.projecteden.nexus.features.radio.RadioUtils.isInRangeOfRadiusRadio)3 Radio (gg.projecteden.nexus.models.radio.RadioConfig.Radio)3 Player (org.bukkit.entity.Player)3 AdventChest (gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest)2 ConverterFor (gg.projecteden.nexus.framework.commands.models.annotations.ConverterFor)2 Switch (gg.projecteden.nexus.framework.commands.models.annotations.Switch)2 TabCompleterFor (gg.projecteden.nexus.framework.commands.models.annotations.TabCompleterFor)2 CommandEvent (gg.projecteden.nexus.framework.commands.models.events.CommandEvent)2 Nerd (gg.projecteden.nexus.models.nerd.Nerd)2 Rank (gg.projecteden.nexus.models.nerd.Rank)2 Nickname (gg.projecteden.nexus.models.nickname.Nickname)2 RadioSong (gg.projecteden.nexus.models.radio.RadioConfig.RadioSong)2 PlayerUtils (gg.projecteden.nexus.utils.PlayerUtils)2