Search in sources :

Example 81 with Permission

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

the class RadioCommand method configAddSong.

@Path("config addSong <radio> <song>")
@Description("Add a song to a radio")
@Permission(Group.ADMIN)
void configAddSong(Radio radio, @Arg(type = RadioSong.class) List<RadioSong> radioSongs) {
    for (RadioSong radioSong : radioSongs) config.addSong(radio, radioSong);
    configService.save(config);
    send(PREFIX + "Added " + radioSongs.stream().map(RadioSong::getName).collect(Collectors.joining(", ")) + " to " + radio.getId());
}
Also used : RadioSong(gg.projecteden.nexus.models.radio.RadioConfig.RadioSong) 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)

Example 82 with Permission

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

the class MobHeadCommand method validateTypes.

@Path("validate types")
@Permission(Group.ADMIN)
void validateTypes() {
    final List<EntityType> missingTypes = MobHeadType.getMissingTypes();
    if (missingTypes.isEmpty()) {
        send(PREFIX + "All entity types have defined mob heads");
        return;
    }
    send(PREFIX + "Missing entity types:");
    for (EntityType entityType : missingTypes) send(" &e" + camelCase(entityType));
}
Also used : EntityType(org.bukkit.entity.EntityType) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 83 with Permission

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

the class Halloween20Command method stats.

@Path("stats")
@Permission(Group.ADMIN)
void stats(@Arg("self") OfflinePlayer player) {
    Halloween20Service service = new Halloween20Service();
    List<Halloween20User> users = service.getAll();
    int foundButtons = 0;
    int foundButtonsComplete = 0;
    int foundPumpkins = 0;
    int foundPumpkinsComplete = 0;
    int foundComboNumbers = 0;
    int foundComboNumbersComplete = 0;
    long totalUsers = users.stream().filter(user -> user.getFoundButtons().size() > 0 || user.getFoundPumpkins().size() > 0 || user.getFoundComboLockNumbers().size() > 0).count();
    for (Halloween20User user : users) {
        foundButtons += user.getFoundButtons().size();
        if (user.getFoundButtons().size() == SoundButton.values().length)
            ++foundButtonsComplete;
        foundPumpkins += user.getFoundPumpkins().size();
        if (user.getFoundPumpkins().size() == Pumpkin.values().length)
            ++foundPumpkinsComplete;
        foundComboNumbers += user.getFoundComboLockNumbers().size();
        if (user.getCombinationStage() == Combination.COMPLETE)
            ++foundComboNumbersComplete;
    }
    send("Total users: " + totalUsers);
    send("Found Buttons: " + (foundButtons / totalUsers) + " avg, " + foundButtonsComplete + " complete");
    send("Found Pumpkins: " + (foundPumpkins / totalUsers) + " avg, " + foundPumpkinsComplete + " complete");
    send("Found Combo Numbers: " + (foundComboNumbers / totalUsers) + " avg, " + foundComboNumbersComplete + " complete");
}
Also used : Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Arrays(java.util.Arrays) Gate(gg.projecteden.nexus.features.events.y2020.halloween20.quest.Gate) TeleportCause(org.bukkit.event.player.PlayerTeleportEvent.TeleportCause) Pumpkin(gg.projecteden.nexus.features.events.y2020.halloween20.models.Pumpkin) CustomCommand(gg.projecteden.nexus.framework.commands.models.CustomCommand) Arg(gg.projecteden.nexus.framework.commands.models.annotations.Arg) Group(gg.projecteden.nexus.framework.commands.models.annotations.Permission.Group) Halloween20Menus(gg.projecteden.nexus.features.events.y2020.halloween20.quest.menus.Halloween20Menus) OfflinePlayer(org.bukkit.OfflinePlayer) ArrayList(java.util.ArrayList) Combination(gg.projecteden.nexus.features.events.y2020.halloween20.models.QuestStage.Combination) Aliases(gg.projecteden.nexus.framework.commands.models.annotations.Aliases) ComboLockNumber(gg.projecteden.nexus.features.events.y2020.halloween20.models.ComboLockNumber) List(java.util.List) Halloween20User(gg.projecteden.nexus.models.halloween20.Halloween20User) CommandEvent(gg.projecteden.nexus.framework.commands.models.events.CommandEvent) QuestStage(gg.projecteden.nexus.features.events.y2020.halloween20.models.QuestStage) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission) Halloween20Service(gg.projecteden.nexus.models.halloween20.Halloween20Service) SoundButton(gg.projecteden.nexus.features.events.y2020.halloween20.models.SoundButton) Halloween20User(gg.projecteden.nexus.models.halloween20.Halloween20User) Halloween20Service(gg.projecteden.nexus.models.halloween20.Halloween20Service) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 84 with Permission

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

the class Halloween20Command method testCombo.

@Path("test combo")
@Permission(Group.ADMIN)
void testCombo() {
    Halloween20Service service = new Halloween20Service();
    Halloween20User user = service.get(player());
    user.getFoundComboLockNumbers().clear();
    user.getFoundComboLockNumbers().addAll(Arrays.asList(ComboLockNumber.values()));
    service.save(user);
    Halloween20Menus.openComboLock(player());
}
Also used : Halloween20User(gg.projecteden.nexus.models.halloween20.Halloween20User) Halloween20Service(gg.projecteden.nexus.models.halloween20.Halloween20Service) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 85 with Permission

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

the class TeleportCommand method lock.

@Path("freeze <player> [enable]")
@Permission(Group.ADMIN)
void lock(Player player, Boolean enable) {
    UUID uuid = player.getUniqueId();
    if (enable == null)
        enable = !preventTeleports.contains(uuid);
    if (enable) {
        preventTeleports.add(uuid);
        send(PREFIX + "&cPreventing &3teleports from &e" + player.getName());
    } else {
        preventTeleports.remove(uuid);
        send(PREFIX + "&aAllowing &3teleports from &e" + player.getName());
    }
}
Also used : UUID(java.util.UUID) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) 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