Search in sources :

Example 76 with Permission

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

the class DyeStationCommand method dye.

@Path("stain <stain>")
@Permission(Group.STAFF)
void dye(StainChoice stainChoice) {
    ItemStack item = getToolRequired();
    Colored.of(stainChoice.getColor()).apply(item);
}
Also used : ItemStack(org.bukkit.inventory.ItemStack) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 77 with Permission

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

the class StaffHallCommand method update.

@Async
@SneakyThrows
@Path("update")
@Permission(Group.ADMIN)
void update() {
    Map<StaffHallRankGroup, List<Nerd>> groups = new HashMap<>();
    Rank.getStaffNerds().get().forEach((rank, nerds) -> groups.computeIfAbsent(StaffHallRankGroup.of(rank), $ -> new ArrayList<>()).addAll(nerds));
    groups.forEach((group, nerds) -> nerds.sort(new SeniorityComparator(group)));
    AtomicInteger wait = new AtomicInteger();
    groups.forEach((group, nerds) -> {
        final List<Integer> npcIds = config.getNpcIds(group);
        for (int index = 0; index < npcIds.size(); index++) {
            final int i = index;
            Tasks.wait(wait.getAndAdd(20), () -> {
                Integer npcId = npcIds.get(i);
                if (nerds.size() >= (i + 1))
                    updateNpc(npcId, nerds.get(i));
                else
                    despawnNpc(npcId);
            });
        }
    });
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) HashMap(java.util.HashMap) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ArrayList(java.util.ArrayList) List(java.util.List) StaffHallRankGroup(gg.projecteden.nexus.models.staffhall.StaffHallConfig.StaffHallRankGroup) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Async(gg.projecteden.annotations.Async) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission) SneakyThrows(lombok.SneakyThrows)

Example 78 with Permission

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

the class NerdCommand method setFirstJoin.

@Path("setFirstJoin <player> <date>")
@Permission(Group.ADMIN)
void setFirstJoin(Nerd nerd, LocalDateTime firstJoin) {
    new NerdService().edit(nerd, _nerd -> _nerd.setFirstJoin(firstJoin));
    send(PREFIX + "Set " + nerd.getNickname() + "'s first join date to &e" + shortDateTimeFormat(nerd.getFirstJoin()));
}
Also used : NerdService(gg.projecteden.nexus.models.nerd.NerdService) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 79 with Permission

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

the class NerdCommand method setPromotionDate.

@Path("setPromotionDate <player> <date>")
@Permission(Group.ADMIN)
void setPromotionDate(Nerd nerd, LocalDate promotionDate) {
    new NerdService().edit(nerd, _nerd -> _nerd.setPromotionDate(promotionDate));
    send(PREFIX + "Set " + nerd.getNickname() + "'s promotion date to &e" + shortDateFormat(nerd.getPromotionDate()));
}
Also used : NerdService(gg.projecteden.nexus.models.nerd.NerdService) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 80 with Permission

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

Permission (gg.projecteden.nexus.framework.commands.models.annotations.Permission)94 Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)93 Async (gg.projecteden.annotations.Async)15 JsonBuilder (gg.projecteden.nexus.utils.JsonBuilder)13 ItemStack (org.bukkit.inventory.ItemStack)13 List (java.util.List)10 CustomCommand (gg.projecteden.nexus.framework.commands.models.CustomCommand)9 Group (gg.projecteden.nexus.framework.commands.models.annotations.Permission.Group)9 CommandEvent (gg.projecteden.nexus.framework.commands.models.events.CommandEvent)9 Arg (gg.projecteden.nexus.framework.commands.models.annotations.Arg)8 Description (gg.projecteden.nexus.framework.commands.models.annotations.Description)8 ArrayList (java.util.ArrayList)8 Nerd (gg.projecteden.nexus.models.nerd.Nerd)7 NerdService (gg.projecteden.nexus.models.nerd.NerdService)7 Utils (gg.projecteden.nexus.utils.Utils)7 HashMap (java.util.HashMap)7 BiFunction (java.util.function.BiFunction)7 Map (java.util.Map)6 Location (org.bukkit.Location)6 Aliases (gg.projecteden.nexus.framework.commands.models.annotations.Aliases)5