Search in sources :

Example 26 with Path

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

the class BannerCommand method all.

@Permission("nexus.banners")
@Path("<baseColor> <patternColor> [input...]")
void all(DyeColor baseColor, DyeColor patternColor, @Arg("*") String input) {
    ItemBuilder baseBanner = new ItemBuilder(ColorType.of(baseColor).getBanner());
    if (input.equalsIgnoreCase("*")) {
        // All Banners
        for (SymbolBanner.Symbol symbol : SymbolBanner.Symbol.values()) {
            ItemBuilder banner = symbol.get(baseBanner.clone(), baseColor, patternColor);
            if (banner != null)
                PlayerUtils.giveItem(player(), banner.build());
        }
    } else {
        // Input Banners
        char[] chars = input.toUpperCase().replaceAll(" ", "").toCharArray();
        for (int i = 0; i < chars.length; i++) {
            char character = input.charAt(i);
            Symbol symbol = Symbol.of(character);
            if (symbol == null)
                continue;
            ItemBuilder banner = symbol.get(baseBanner.clone(), baseColor, patternColor);
            if (banner != null)
                PlayerUtils.giveItem(player(), banner.build());
        }
    }
}
Also used : ItemBuilder(gg.projecteden.nexus.utils.ItemBuilder) SymbolBanner(gg.projecteden.nexus.utils.SymbolBanner) Symbol(gg.projecteden.nexus.utils.SymbolBanner.Symbol) Symbol(gg.projecteden.nexus.utils.SymbolBanner.Symbol) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 27 with Path

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

the class BoostsCommand method start.

@Confirm
@Permission(Group.SENIOR_STAFF)
@Path("start <type> <multiplier> <duration>")
void start(Boostable type, double multiplier, int duration) {
    if (config.hasBoost(type))
        cancel(type, true);
    Booster booster = service.get(Dev.KODA.getUuid());
    Boost boost = booster.add(type, multiplier, duration);
    boost.activate();
    service.save(booster);
    send(PREFIX + "Started a server " + boost.getMultiplierFormatted() + " " + camelCase(type) + " boost for " + Timespan.ofSeconds(boost.getDuration()).format(FormatType.LONG));
}
Also used : Boost(gg.projecteden.nexus.models.boost.Booster.Boost) Booster(gg.projecteden.nexus.models.boost.Booster) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission) Confirm(gg.projecteden.nexus.framework.commands.models.annotations.Confirm)

Example 28 with Path

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

the class BoostsCommand method cancel.

@Confirm
@Permission(Group.STAFF)
@Path("cancel <type> [--refund]")
void cancel(Boostable type, @Switch boolean refund) {
    if (!config.hasBoost(type))
        error("There is no active " + camelCase(type) + " boost");
    Boost boost = config.getBoost(type);
    boost.cancel();
    if (refund)
        boost.getBooster().add(type, boost.getMultiplier(), boost.getDurationLeft());
    service.save(boost.getBooster());
    send(PREFIX + "Cancelled " + boost.getNickname() + "'s " + boost.getMultiplierFormatted() + " " + camelCase(type) + " boost" + (refund ? " and refunded the time left" : ""));
}
Also used : Boost(gg.projecteden.nexus.models.boost.Booster.Boost) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission) Confirm(gg.projecteden.nexus.framework.commands.models.annotations.Confirm)

Example 29 with Path

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

the class CostumeCommand method top.

@Path("top [page]")
@Permission(Group.ADMIN)
void top(@Arg("1") int page) {
    Map<Costume, Integer> counts = new HashMap<>() {

        {
            for (CostumeUser user : service.getAll()) if (user.getRank() != Rank.ADMIN)
                for (String costume : user.getOwnedCostumes()) put(Costume.of(costume), getOrDefault(costume, 0) + 1);
        }
    };
    final BiFunction<Costume, String, JsonBuilder> formatter = (costume, index) -> json(index + " &e" + costume.getId() + " &7- " + counts.get(costume));
    paginate(Utils.sortByValueReverse(counts).keySet(), formatter, "/costume top", page);
}
Also used : JsonBuilder(gg.projecteden.nexus.utils.JsonBuilder) StringUtils(gg.projecteden.nexus.utils.StringUtils) BiFunction(java.util.function.BiFunction) ConverterFor(gg.projecteden.nexus.framework.commands.models.annotations.ConverterFor) Player(org.bukkit.entity.Player) EventHandler(org.bukkit.event.EventHandler) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) MaterialTag(gg.projecteden.nexus.utils.MaterialTag) InventoryContents(fr.minuskube.inv.content.InventoryContents) Map(java.util.Map) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission) DyeStation(gg.projecteden.nexus.features.custombenches.DyeStation) Material(org.bukkit.Material) EXCLUSIVE(gg.projecteden.nexus.models.costume.Costume.EXCLUSIVE) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Rank(gg.projecteden.nexus.models.nerd.Rank) DyeStationMenu(gg.projecteden.nexus.features.custombenches.DyeStation.DyeStationMenu) NonNull(lombok.NonNull) Tasks(gg.projecteden.nexus.utils.Tasks) Collectors(java.util.stream.Collectors) ItemStack(org.bukkit.inventory.ItemStack) Aliases(gg.projecteden.nexus.framework.commands.models.annotations.Aliases) List(java.util.List) CustomModelFolder(gg.projecteden.nexus.features.resourcepack.models.files.CustomModelFolder) MenuUtils(gg.projecteden.nexus.features.menus.MenuUtils) CostumeType(gg.projecteden.nexus.models.costume.Costume.CostumeType) TabCompleterFor(gg.projecteden.nexus.framework.commands.models.annotations.TabCompleterFor) OnlinePlayers(gg.projecteden.nexus.utils.PlayerUtils.OnlinePlayers) CustomModel(gg.projecteden.nexus.features.resourcepack.models.CustomModel) SmartInventory(fr.minuskube.inv.SmartInventory) JsonBuilder(gg.projecteden.nexus.utils.JsonBuilder) Arg(gg.projecteden.nexus.framework.commands.models.annotations.Arg) HashMap(java.util.HashMap) Group(gg.projecteden.nexus.framework.commands.models.annotations.Permission.Group) InventoryCloseEvent(org.bukkit.event.inventory.InventoryCloseEvent) ICON(gg.projecteden.nexus.features.resourcepack.models.CustomModel.ICON) ResourcePackUpdateStartEvent(gg.projecteden.nexus.features.resourcepack.models.events.ResourcePackUpdateStartEvent) ColorType(gg.projecteden.nexus.utils.ColorType) ArrayList(java.util.ArrayList) InvalidInputException(gg.projecteden.nexus.framework.exceptions.postconfigured.InvalidInputException) Costume(gg.projecteden.nexus.models.costume.Costume) CostumeUserService(gg.projecteden.nexus.models.costume.CostumeUserService) ResourcePackUpdateCompleteEvent(gg.projecteden.nexus.features.resourcepack.models.events.ResourcePackUpdateCompleteEvent) ClickableItem(fr.minuskube.inv.ClickableItem) ChatColor(net.md_5.bungee.api.ChatColor) Listener(org.bukkit.event.Listener) StoreGallery(gg.projecteden.nexus.features.store.gallery.StoreGallery) ItemBuilder(gg.projecteden.nexus.utils.ItemBuilder) CostumeUser(gg.projecteden.nexus.models.costume.CostumeUser) CustomCommand(gg.projecteden.nexus.framework.commands.models.CustomCommand) Utils(gg.projecteden.nexus.utils.Utils) TickTime(gg.projecteden.utils.TimeUtils.TickTime) CommandEvent(gg.projecteden.nexus.framework.commands.models.events.CommandEvent) AllArgsConstructor(lombok.AllArgsConstructor) NoArgsConstructor(lombok.NoArgsConstructor) CostumeUser(gg.projecteden.nexus.models.costume.CostumeUser) HashMap(java.util.HashMap) Costume(gg.projecteden.nexus.models.costume.Costume) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission)

Example 30 with Path

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

the class ItemNameCommand method reset.

@Path("resetAll <material>")
void reset(Material material) {
    int count = 0;
    for (ItemStack content : inventory().getContents()) {
        if (isNullOrAir(content))
            continue;
        if (content.getType() != material)
            continue;
        final ItemMeta meta = content.getItemMeta();
        meta.setDisplayName(null);
        content.setItemMeta(meta);
        ++count;
    }
    send(PREFIX + "Reset item names of " + count + " " + camelCase(material));
}
Also used : ItemStack(org.bukkit.inventory.ItemStack) ItemMeta(org.bukkit.inventory.meta.ItemMeta) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path)

Aggregations

Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)333 Permission (gg.projecteden.nexus.framework.commands.models.annotations.Permission)110 JsonBuilder (gg.projecteden.nexus.utils.JsonBuilder)51 Async (gg.projecteden.annotations.Async)48 ItemStack (org.bukkit.inventory.ItemStack)38 CommandEvent (gg.projecteden.nexus.framework.commands.models.events.CommandEvent)31 ArrayList (java.util.ArrayList)31 CustomCommand (gg.projecteden.nexus.framework.commands.models.CustomCommand)30 Description (gg.projecteden.nexus.framework.commands.models.annotations.Description)29 List (java.util.List)28 Location (org.bukkit.Location)28 Group (gg.projecteden.nexus.framework.commands.models.annotations.Permission.Group)27 UUID (java.util.UUID)26 Arg (gg.projecteden.nexus.framework.commands.models.annotations.Arg)25 Nerd (gg.projecteden.nexus.models.nerd.Nerd)24 HashMap (java.util.HashMap)24 BiFunction (java.util.function.BiFunction)21 Map (java.util.Map)20 Player (org.bukkit.entity.Player)20 NonNull (lombok.NonNull)18