Plugin <=> CommandSystem interaction.
parent
2b0238dff1
commit
279d8aae13
@ -0,0 +1,39 @@
|
|||||||
|
package net.pingex.dcf.commands;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicated a method which is in fact a command
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface AnnotatedCommand
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Main name of the command
|
||||||
|
*/
|
||||||
|
String name();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command can also be called using the following list of aliases
|
||||||
|
*/
|
||||||
|
String[] aliases() default {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of the command.
|
||||||
|
*/
|
||||||
|
String description() default Command.Defaults.DESCRIPTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the command enabled ? Can it be invoked ?
|
||||||
|
*/
|
||||||
|
boolean isEnabled() default Command.Defaults.IS_ENABLED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Command usage help
|
||||||
|
*/
|
||||||
|
String usage() default Command.Defaults.USAGE;
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package net.pingex.dcf.commands;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates a plugin which can run commands (using annotated commands)
|
||||||
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IWithAnnotatedCommands
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Gives all annotated commands for this plugin.
|
||||||
|
* @return A set of objects which contains annotated commands.
|
||||||
|
*/
|
||||||
|
Set<Object> getAnnotatedObjects();
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package net.pingex.dcf.commands;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates a plugin which can run commands (using commands object)
|
||||||
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IWithCommands
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Give all commands
|
||||||
|
* @return ALL THE COMMANDS \o/
|
||||||
|
*/
|
||||||
|
Set<Command> getCommands();
|
||||||
|
}
|
Reference in New Issue