use of gg.projecteden.annotations.Async 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.annotations.Async 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);
}
use of gg.projecteden.annotations.Async in project Nexus by ProjectEdenGG.
the class FirstLoginCommand method stats.
@Async
@Path("stats")
@Permission(Group.ADMIN)
void stats() {
StringBuilder data = new StringBuilder();
for (Nerd nerd : new NerdService().getAll()) if (nerd.getFirstJoin() != null)
data.append(nerd.getNickname()).append(",").append(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(nerd.getFirstJoin())).append(System.lineSeparator());
IOUtils.fileAppend("joindates.csv", data.toString());
send(PREFIX + "Generated joindates.csv");
}
use of gg.projecteden.annotations.Async in project Nexus by ProjectEdenGG.
the class BadgeCommand method convert.
@Async
@Permission(Group.ADMIN)
@Path("convert")
void convert() {
int i = 0;
int owned = 0;
int active = 0;
final List<Nerd> nerds = new NerdService().getAll();
send(PREFIX + "Converting checkmarks");
for (Nerd nerd : nerds) {
if (!LuckPermsUtils.hasPermission(nerd, "donated"))
continue;
final BadgeUser user = service.get(nerd);
user.give(Badge.SUPPORTER);
++owned;
if (nerd.isCheckmark()) {
user.setActive(Badge.SUPPORTER);
++active;
}
if (++i % 25 == 0)
send(PREFIX + "Converted &e" + i + "&3/&e" + nerds.size());
}
service.saveCache();
send(PREFIX + "Completed; &e" + owned + " &3owned, &e" + active + " &3active");
}
use of gg.projecteden.annotations.Async in project Nexus by ProjectEdenGG.
the class AeveonProjectCommand method flora.
@Async
@Path("flora [radius]")
public void flora(@Arg("5") int radius) {
final int finalRadius = Math.max(1, Math.min(radius, 25));
List<Block> placeFloraOn = new ArrayList<>();
List<Block> blocks = BlockUtils.getBlocksInRadius(location(), finalRadius);
for (Block block : blocks) {
Block above = block.getRelative(BlockFace.UP);
if (allowedFloraMaterials.contains(block.getType()) && isNullOrAir(above))
placeFloraOn.add(above);
}
for (Block block : placeFloraOn) {
Material material = getWeightedRandom(floraChanceMap);
Tasks.sync(() -> {
block.setType(material);
if (material.equals(Material.TWISTING_VINES_PLANT) && RandomUtils.chanceOf(75))
block.getRelative(BlockFace.UP).setType(Material.TWISTING_VINES);
});
}
}
Aggregations