use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.
the class BirthdayEventCommand method topLocations.
@Path("topLocations [page]")
@Permission(Group.ADMIN)
void topLocations(@Arg("1") int page) {
Map<Location, Integer> counts = new HashMap<>() {
{
for (Birthday21User user : new Birthday21UserService().getAll()) for (Location location : user.getFound()) put(location, getOrDefault(location, 0) + 1);
}
};
send(PREFIX + "Most found cakes");
BiFunction<Location, String, JsonBuilder> formatter = (location, index) -> json(index + " &e" + getCoordinateString(location) + " &7- " + counts.get(location)).command(getTeleportCommand(location)).hover("&eClick to teleport");
paginate(Utils.sortByValueReverse(counts).keySet(), formatter, "/birthdayevent topLocations", page);
}
use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.
the class WitherCommand method maintenance.
@Path("maintenance")
@Permission(Group.STAFF)
void maintenance() {
new WitherArenaConfigService().edit0(config -> config.setMaintenance(!isMaintenance()));
send(PREFIX + "Wither arena maintenance mode " + (isMaintenance() ? "&aenabled" : "&cdisabled"));
}
use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.
the class WitherCommand method beta.
@Path("beta")
@Permission(Group.ADMIN)
void beta() {
new WitherArenaConfigService().edit0(config -> config.setBeta(!isBeta()));
send(PREFIX + "Wither arena beta mode " + (isBeta() ? "&aenabled" : "&cdisabled"));
}
use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.
the class TicketsCommand method statsClosed.
@Path("stats closed [page]")
@Permission(Group.MODERATOR)
void statsClosed(@Arg("1") int page) {
Map<UUID, Integer> closers = new HashMap<>();
for (Ticket ticket : tickets.getAll()) {
if (ticket.isOpen())
continue;
if (ticket.getClosedBy() == null)
continue;
if (ticket.getClosedBy().equals(ticket.getUuid()))
continue;
closers.put(ticket.getClosedBy(), closers.getOrDefault(ticket.getClosedBy(), 0) + 1);
}
BiFunction<UUID, String, JsonBuilder> formatter = (uuid, index) -> json(index + " &e" + Nerd.of(uuid).getColoredName() + " &7- " + closers.get(uuid));
paginate(Utils.sortByValueReverse(closers).keySet(), formatter, "/tickets stats closed", page);
}
use of gg.projecteden.nexus.framework.commands.models.annotations.Permission in project Nexus by ProjectEdenGG.
the class CommandMapUtils method register.
void register(String name, CustomCommand customCommand) throws IllegalAccessException, InvocationTargetException, InstantiationException {
if (customCommand.getClass().getAnnotation(DoubleSlash.class) != null)
name = "/" + name;
name = name.toLowerCase();
CommandHandler handler = new CommandHandler(customCommand);
PluginCommand pluginCommand = COMMAND_CONSTRUCTOR.newInstance(name, plugin);
pluginCommand.setLabel(name);
pluginCommand.setAliases(customCommand.getAliases());
pluginCommand.setExecutor(handler);
Description description = customCommand.getClass().getAnnotation(Description.class);
if (description != null)
pluginCommand.setDescription(description.value());
Permission permission = customCommand.getClass().getAnnotation(Permission.class);
if (permission != null)
pluginCommand.setPermission(permission.value());
commandMap.register(plugin.getDescription().getName(), pluginCommand);
knownCommandMap.put(plugin.getDescription().getName().toLowerCase() + ":" + name, pluginCommand);
knownCommandMap.put(name, pluginCommand);
registerRedirects(customCommand);
}
Aggregations