FreedomNetworkSuite/Patchwork/src/main/java/me/totalfreedom/command/annotation/Completion.java

32 lines
939 B
Java
Raw Normal View History

2023-05-23 22:11:08 +00:00
package me.totalfreedom.command.annotation;
import java.lang.annotation.ElementType;
2023-05-30 22:39:54 +00:00
import java.lang.annotation.Repeatable;
2023-05-23 22:11:08 +00:00
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
2023-06-08 15:02:20 +00:00
/**
* Represents a tab completion for a command.
* <p>
* This will register at class level, and does not retain method information. As a result, you only need to register the
* arguments a single time, and it will always be used in tab completions.
*/
@Target(ElementType.TYPE)
2023-05-30 22:39:54 +00:00
@Repeatable(Completions.class)
2023-05-23 22:11:08 +00:00
@Retention(RetentionPolicy.RUNTIME)
public @interface Completion
{
2023-06-08 15:02:20 +00:00
/**
* An array of possible arguments for this particular index, represented by {@link #index()}.
*
* @return An array of possible arguments for tab completion.
*/
2023-05-23 22:11:08 +00:00
String[] args();
2023-06-08 15:02:20 +00:00
/**
* @return The index in which these arguments should be shown.
*/
2023-05-23 22:11:08 +00:00
int index();
}