Search in sources :

Example 16 with Description

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

the class Pugmas20Command method progress.

@Path("progress [player]")
@Description("View your event progress")
void progress(@Arg(value = "self", permission = Group.STAFF) Pugmas20User user) {
    LocalDate now = LocalDate.now();
    if (isBeforePugmas(now))
        now = now.withYear(2020).withMonth(12).withDayOfMonth(1);
    if (isPastPugmas(now))
        error("Next year!");
    if (isSecondChance(now))
        now = now.withYear(2020).withMonth(12).withDayOfMonth(25);
    int day = now.getDayOfMonth();
    line(2);
    send(PREFIX + "Event progress (Day &e#" + day + "&3):");
    line();
    String advent;
    AdventChest adventChest = AdventChests.getAdventChest(day);
    if (user.getFoundDays().size() == 25)
        advent = "&a☑ &3Complete";
    else if (user.getFoundDays().contains(day))
        advent = "&a☑ &3Found today's chest";
    else if (day == 25)
        if (user.getFoundDays().size() != 24)
            advent = "&7☐ &3Find all chests before #25";
        else
            advent = "&7☐ &3Find the last chest";
    else
        advent = "&7☐ &3Find today's chest (&e#" + day + " &3in the &e" + adventChest.getDistrict().getName() + " District&3)";
    send("&6&lAdvent Chests");
    send(json("&f  " + advent + " &7- Click for info").hover("Click to open the Advent menu").command("/pugmas advent"));
    line();
    send("&6&lQuests");
    for (Pugmas20QuestStageHelper quest : Pugmas20QuestStageHelper.values()) {
        QuestStage stage = quest.getter().apply(user);
        String instructions = Pugmas20Quest.valueOf(quest.name()).getInstructions(user, stage);
        JsonBuilder json = json();
        if (quest == Pugmas20QuestStageHelper.THE_MINES && stage == QuestStage.STARTED) {
            List<String> tradesLeft = getIngotTradesLeft(user);
            if (tradesLeft.isEmpty()) {
                json.next("&f  &a☑ &3" + camelCase(quest) + " &7- &aCompleted daily quest &7- Come back tomorrow for more");
            } else {
                json.next("&f  &7☐ &3" + camelCase(quest) + " &7- &eIn progress &7- " + instructions);
                tradesLeft.add(0, "&6Today's available trades:");
                json.next(" &7&o(Hover for info)").hover(String.join("\n", tradesLeft));
            }
        } else {
            if (stage == QuestStage.COMPLETE) {
                json.next("&f  &a☑ &3" + camelCase(quest) + " &7- &aComplete");
            } else if (stage == QuestStage.NOT_STARTED || stage == QuestStage.INELIGIBLE) {
                json.next("&f  &7☐ &3" + camelCase(quest) + " &7- &cNot started" + (instructions == null ? "" : " &7- " + instructions));
            } else {
                json.next("&f  &7☐ &3" + camelCase(quest) + " &7- &eIn progress &7- ");
                if (instructions == null)
                    json.next("&c???").hover(camelCase(stage));
                else
                    json.next("&7" + instructions);
            }
            if (quest == Pugmas20QuestStageHelper.TOY_TESTING && stage == QuestStage.STARTED) {
                List<String> toysLeft = getUnplayedToysList(user);
                toysLeft.add(0, "&6Toys left to test:");
                json.next(" &7&o(Hover for info)").hover(String.join("\n&f", toysLeft));
            }
            if (quest == Pugmas20QuestStageHelper.ORNAMENT_VENDOR && stage != QuestStage.NOT_STARTED) {
                List<String> lore = getOrnamentTradesLeft(user);
                if (!lore.isEmpty()) {
                    lore.add(0, "&6Available ornament trades:");
                    if (stage == QuestStage.COMPLETE)
                        json.next(" &7- More trades available");
                    lore.add("&f");
                    lore.add("&fYou get to keep any extra ornaments");
                    json.next(" &7&o(Hover for info)").hover(String.join("\n&f", lore));
                }
            }
        }
        send(json);
    }
    line();
    if (day < 25) {
        send("&3Next day begins in &e" + Timespan.of(now.plusDays(1)).format());
        line();
    }
}
Also used : JsonBuilder(gg.projecteden.nexus.utils.JsonBuilder) Pugmas20QuestStageHelper(gg.projecteden.nexus.features.events.y2020.pugmas20.quests.Quests.Pugmas20QuestStageHelper) QuestStage(gg.projecteden.nexus.features.events.models.QuestStage) LocalDate(java.time.LocalDate) AdventChest(gg.projecteden.nexus.features.events.y2020.pugmas20.models.AdventChest) Pugmas20.showWaypoint(gg.projecteden.nexus.features.events.y2020.pugmas20.Pugmas20.showWaypoint) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description)

Example 17 with Description

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

the class CommandMapUtils method register.

void register(String name, CustomCommand customCommand) throws IllegalAccessException, InvocationTargetException, InstantiationException {
    if (customCommand.getClass().getAnnotation(DoubleSlash.class) != null)
        name = "/" + name;
    name = name.toLowerCase();
    CommandHandler handler = new CommandHandler(customCommand);
    PluginCommand pluginCommand = COMMAND_CONSTRUCTOR.newInstance(name, plugin);
    pluginCommand.setLabel(name);
    pluginCommand.setAliases(customCommand.getAliases());
    pluginCommand.setExecutor(handler);
    Description description = customCommand.getClass().getAnnotation(Description.class);
    if (description != null)
        pluginCommand.setDescription(description.value());
    Permission permission = customCommand.getClass().getAnnotation(Permission.class);
    if (permission != null)
        pluginCommand.setPermission(permission.value());
    commandMap.register(plugin.getDescription().getName(), pluginCommand);
    knownCommandMap.put(plugin.getDescription().getName().toLowerCase() + ":" + name, pluginCommand);
    knownCommandMap.put(name, pluginCommand);
    registerRedirects(customCommand);
}
Also used : Description(gg.projecteden.nexus.framework.commands.models.annotations.Description) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission) DoubleSlash(gg.projecteden.nexus.framework.commands.models.annotations.DoubleSlash) PluginCommand(org.bukkit.command.PluginCommand)

Example 18 with Description

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

the class RadioCommand method songInfo.

@Path("info")
@Description("Shows info about the radio you are listening to")
void songInfo() {
    Radio radio = RadioUtils.getListenedRadio(player(), true);
    if (radio == null)
        error("You are not listening to a radio!");
    SongPlayer songPlayer = radio.getSongPlayer();
    Song song = songPlayer.getSong();
    send(PREFIX + "Radio Info:");
    send("&3Radio: &e" + StringUtils.camelCase(radio.getId()));
    List<String> list = RadioUtils.getPlaylistHover(radio);
    send(json("&3Songs: &e[" + list.size() + "]").hover(list).loreize(false));
    send("&3Playing: &e" + song.getTitle() + " &3by &e" + song.getAuthor() + " &3(" + getSongPercent(songPlayer) + "%)");
    line();
}
Also used : RadioSong(gg.projecteden.nexus.models.radio.RadioConfig.RadioSong) Song(com.xxmicloxx.NoteBlockAPI.model.Song) SongPlayer(com.xxmicloxx.NoteBlockAPI.songplayer.SongPlayer) Radio(gg.projecteden.nexus.models.radio.RadioConfig.Radio) RadioUtils.getListenedRadio(gg.projecteden.nexus.features.radio.RadioUtils.getListenedRadio) RadioUtils.isInRangeOfRadiusRadio(gg.projecteden.nexus.features.radio.RadioUtils.isInRangeOfRadiusRadio) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description)

Example 19 with Description

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

the class RadioCommand method joinRadio.

@Path("join [radio]")
@Description("Join a radio")
void joinRadio(Radio radio) {
    if (user.isMute())
        error("You have muted all radios!");
    if (radio == null) {
        radio = RadioUtils.getRadiusRadio(player());
        if (radio == null)
            error("You are not near a radio!\nChoices: &e" + RadioUtils.getServerRadios().stream().map(Radio::getId).collect(Collectors.joining("&3, &e")));
    }
    if (radio.getType().equals(RadioType.RADIUS) && !isInRangeOfRadiusRadio(player(), radio))
        error("You are not near that radio!");
    if (!radio.isEnabled())
        error("That radio is not enabled!");
    Radio listenedRadio = getListenedRadio(player(), true);
    if (listenedRadio != null)
        removePlayer(player(), listenedRadio);
    if (radio.getType().equals(RadioType.RADIUS))
        user.getLeftRadiusRadios().remove(radio.getId());
    addPlayer(player(), radio);
}
Also used : Radio(gg.projecteden.nexus.models.radio.RadioConfig.Radio) RadioUtils.getListenedRadio(gg.projecteden.nexus.features.radio.RadioUtils.getListenedRadio) RadioUtils.isInRangeOfRadiusRadio(gg.projecteden.nexus.features.radio.RadioUtils.isInRangeOfRadiusRadio) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description)

Example 20 with Description

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

the class RadioCommand method listListeners.

// Staff Commands
@Path("players <radio>")
@Description("Lists all players listening to the server radio")
@Permission(Group.STAFF)
void listListeners(Radio radio) {
    Set<UUID> uuids = radio.getSongPlayer().getPlayerUUIDs();
    if (uuids.size() == 0)
        error("No players are listening to " + radio.getId());
    send(PREFIX + "Players listening to " + radio.getId() + ":");
    int ndx = 1;
    for (UUID uuid : uuids) {
        send("&3" + ndx++ + " &e" + Nickname.of(uuid));
    }
}
Also used : UUID(java.util.UUID) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

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