Search in sources :

Example 1 with CommandRunEvent

use of gg.projecteden.nexus.framework.commands.models.events.CommandRunEvent in project Nexus by ProjectEdenGG.

the class ICustomCommand method checkCooldown.

private void checkCooldown(CustomCommand command) {
    Method method = ((CommandRunEvent) command.getEvent()).getMethod();
    checkCooldown(command, command.getClass().getAnnotation(Cooldown.class), command.getName());
    checkCooldown(command, method.getAnnotation(Cooldown.class), command.getName() + "#" + method.getName());
}
Also used : CommandRunEvent(gg.projecteden.nexus.framework.commands.models.events.CommandRunEvent) Cooldown(gg.projecteden.nexus.framework.commands.models.annotations.Cooldown) Method(java.lang.reflect.Method)

Example 2 with CommandRunEvent

use of gg.projecteden.nexus.framework.commands.models.events.CommandRunEvent in project Nexus by ProjectEdenGG.

the class ICustomCommand method getNewCommand.

@SneakyThrows
CustomCommand getNewCommand(CommandEvent originalEvent, Class<?> clazz) {
    CustomCommand customCommand = new ObjenesisStd().newInstance((Class<? extends CustomCommand>) clazz);
    CommandRunEvent newEvent = new CommandRunEvent(originalEvent.getSender(), customCommand, customCommand.getName(), new ArrayList<>(), new ArrayList<>());
    return getCommand(newEvent);
}
Also used : CommandRunEvent(gg.projecteden.nexus.framework.commands.models.events.CommandRunEvent) ObjenesisStd(org.objenesis.ObjenesisStd) SneakyThrows(lombok.SneakyThrows)

Aggregations

CommandRunEvent (gg.projecteden.nexus.framework.commands.models.events.CommandRunEvent)2 Cooldown (gg.projecteden.nexus.framework.commands.models.annotations.Cooldown)1 Method (java.lang.reflect.Method)1 SneakyThrows (lombok.SneakyThrows)1 ObjenesisStd (org.objenesis.ObjenesisStd)1