Search in sources :

Example 11 with Permission

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

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

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

the class VanishCommand method fakeQuit.

@Path("(fq|fakequit)")
@Permission("vanish.fakeannounce")
void fakeQuit() {
    JoinQuit.quit(player());
    new NerdService().edit(nerd(), nerd -> nerd.setLastVanish(LocalDateTime.now()));
    runCommand("vanish on");
}
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 14 with Permission

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

the class StoreCommand method coupon_create.

@Async
@SneakyThrows
@Path("coupons create <player> <amount>")
@Permission(Group.ADMIN)
void coupon_create(Contributor contributor, double amount) {
    String code = new CouponCreator(contributor, amount).create();
    send(json(PREFIX + "Created coupon &e" + code).copy(code).hover("&fClick to copy"));
}
Also used : CouponCreator(gg.projecteden.nexus.features.store.BuycraftUtils.CouponCreator) 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 15 with Permission

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

the class StoreCommand method coupon_list.

@Async
@SneakyThrows
@Path("coupons list <player>")
void coupon_list(@Arg(value = "self", permission = Group.STAFF) Contributor contributor) {
    final List<Coupon> coupons = Nexus.getBuycraft().getApiClient().getAllCoupons().execute().body().getData().stream().filter(coupon -> coupon.getUsername().equals(contributor.getName())).filter(coupon -> coupon.getExpire().getLimit() > 0).toList();
    if (coupons.isEmpty())
        error("No coupons found" + (isSelf(contributor) ? ". Create one with /store credit redeem <amount>" : " for " + contributor.getNickname()));
    send(PREFIX + "Available coupons (&eClick &3to copy)");
    line();
    for (Coupon coupon : coupons) send(json(" &e" + coupon.getCode() + " &7- $" + coupon.getDiscount().getValue()).copy(coupon.getCode()).hover("&fClick to copy"));
    line();
    send("&3Redeem at &e" + StoreCommand.URL);
}
Also used : StringUtils(gg.projecteden.nexus.utils.StringUtils) SneakyThrows(lombok.SneakyThrows) SmartInventory(fr.minuskube.inv.SmartInventory) JsonBuilder(gg.projecteden.nexus.utils.JsonBuilder) DisplaySet(gg.projecteden.nexus.features.store.gallery.StoreGalleryNPCs.DisplaySet) TabCompleteIgnore(gg.projecteden.nexus.framework.commands.models.annotations.TabCompleteIgnore) BiFunction(java.util.function.BiFunction) Async(gg.projecteden.annotations.Async) ContributorService(gg.projecteden.nexus.models.store.ContributorService) StoreGalleryNPCs(gg.projecteden.nexus.features.store.gallery.StoreGalleryNPCs) Arg(gg.projecteden.nexus.framework.commands.models.annotations.Arg) Group(gg.projecteden.nexus.framework.commands.models.annotations.Permission.Group) Player(org.bukkit.entity.Player) Contributor(gg.projecteden.nexus.models.store.Contributor) ArrayList(java.util.ArrayList) EventHandler(org.bukkit.event.EventHandler) PlayerUtils(gg.projecteden.nexus.utils.PlayerUtils) WarpType(gg.projecteden.nexus.models.warps.WarpType) PlayerRankChangeEvent(gg.projecteden.nexus.utils.LuckPermsUtils.GroupChange.PlayerRankChangeEvent) InventoryProvider(fr.minuskube.inv.content.InventoryProvider) InventoryContents(fr.minuskube.inv.content.InventoryContents) Permission(gg.projecteden.nexus.framework.commands.models.annotations.Permission) ExtraPlotUserService(gg.projecteden.nexus.models.extraplots.ExtraPlotUserService) CouponCreator(gg.projecteden.nexus.features.store.BuycraftUtils.CouponCreator) StoreCategory(gg.projecteden.nexus.features.store.annotations.Category.StoreCategory) Nickname(gg.projecteden.nexus.models.nickname.Nickname) Purchase(gg.projecteden.nexus.models.store.Contributor.Purchase) Material(org.bukkit.Material) ClickableItem(fr.minuskube.inv.ClickableItem) Listener(org.bukkit.event.Listener) Nexus(gg.projecteden.nexus.Nexus) ItemBuilder(gg.projecteden.nexus.utils.ItemBuilder) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) NPCListener(gg.projecteden.nexus.features.store.perks.NPCListener) Nerd(gg.projecteden.nexus.models.nerd.Nerd) CustomCommand(gg.projecteden.nexus.framework.commands.models.CustomCommand) UUID(java.util.UUID) StringUtils.prettyMoney(gg.projecteden.nexus.utils.StringUtils.prettyMoney) Coupon(net.buycraft.plugin.data.Coupon) Utils(gg.projecteden.nexus.utils.Utils) OfflinePlayer(org.bukkit.OfflinePlayer) Aliases(gg.projecteden.nexus.framework.commands.models.annotations.Aliases) List(java.util.List) CommandEvent(gg.projecteden.nexus.framework.commands.models.events.CommandEvent) MenuUtils(gg.projecteden.nexus.features.menus.MenuUtils) AllArgsConstructor(lombok.AllArgsConstructor) NoArgsConstructor(lombok.NoArgsConstructor) Coupon(net.buycraft.plugin.data.Coupon) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Async(gg.projecteden.annotations.Async) SneakyThrows(lombok.SneakyThrows)

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