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" : ""));
}
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);
}
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");
}
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"));
}
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);
}
Aggregations