Search in sources :

Example 1 with PermissionsFrom

use of io.github.nucleuspowered.nucleus.internal.annotations.command.PermissionsFrom in project Nucleus by NucleusPowered.

the class PermissionRegistry method getPermissionsForNucleusCommand.

public CommandPermissionHandler getPermissionsForNucleusCommand(Class<? extends AbstractCommand> command) {
    if (this.serviceRegistry.containsKey(command)) {
        return this.serviceRegistry.get(command);
    }
    PermissionsFrom p = command.getAnnotation(PermissionsFrom.class);
    if (p != null && p.value() != AbstractCommand.class) {
        return getPermissionsForNucleusCommand(p.value());
    }
    CommandPermissionHandler handler = new CommandPermissionHandler(command, Nucleus.getNucleus());
    serviceRegistry.put(command, handler);
    return handler;
}
Also used : AbstractCommand(io.github.nucleuspowered.nucleus.internal.command.AbstractCommand) PermissionsFrom(io.github.nucleuspowered.nucleus.internal.annotations.command.PermissionsFrom)

Aggregations

PermissionsFrom (io.github.nucleuspowered.nucleus.internal.annotations.command.PermissionsFrom)1 AbstractCommand (io.github.nucleuspowered.nucleus.internal.command.AbstractCommand)1