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