diff --git a/src/main/java/net/minestom/server/command/builder/ArgumentCallback.java b/src/main/java/net/minestom/server/command/builder/ArgumentCallback.java index aab58802e..bf1c0dfe4 100644 --- a/src/main/java/net/minestom/server/command/builder/ArgumentCallback.java +++ b/src/main/java/net/minestom/server/command/builder/ArgumentCallback.java @@ -4,7 +4,7 @@ import net.minestom.server.command.CommandSender; import net.minestom.server.command.builder.arguments.Argument; /** - * Callback executed when an error is found within the {@link Argument} + * Callback executed when an error is found within the {@link Argument}. */ @FunctionalInterface public interface ArgumentCallback { diff --git a/src/main/java/net/minestom/server/command/builder/CommandSyntax.java b/src/main/java/net/minestom/server/command/builder/CommandSyntax.java index 9a6c255ae..f452a372e 100644 --- a/src/main/java/net/minestom/server/command/builder/CommandSyntax.java +++ b/src/main/java/net/minestom/server/command/builder/CommandSyntax.java @@ -2,23 +2,41 @@ package net.minestom.server.command.builder; import net.minestom.server.command.builder.arguments.Argument; +/** + * Represents a syntax in {@link Command}. + */ public class CommandSyntax { - private Argument[] args; + private final Argument[] args; private CommandExecutor executor; - public CommandSyntax(Argument... args) { + protected CommandSyntax(Argument... args) { this.args = args; } + /** + * Get all the required {@link Argument} for this sytnax + * + * @return the required arguments + */ public Argument[] getArguments() { return args; } + /** + * Get the {@link CommandExecutor} of this syntax, executed once the syntax is properly wrote. + * + * @return the executor of this syntax + */ public CommandExecutor getExecutor() { return executor; } + /** + * Change the {@link CommandExecutor} of this syntax + * + * @param executor the new executor + */ public void setExecutor(CommandExecutor executor) { this.executor = executor; } diff --git a/src/main/java/net/minestom/server/command/builder/arguments/Argument.java b/src/main/java/net/minestom/server/command/builder/arguments/Argument.java index 40f418ca9..dc9f16af5 100644 --- a/src/main/java/net/minestom/server/command/builder/arguments/Argument.java +++ b/src/main/java/net/minestom/server/command/builder/arguments/Argument.java @@ -7,6 +7,11 @@ import net.minestom.server.command.builder.Command; * An argument is meant to be parsed when added into a {@link Command} syntax. *
* You can create your own with your own special conditions. + *
+ * Here in order, how is parsed an argument: {@link #getCorrectionResult(String)} to check
+ * if the syntax is correct, {@link #parse(String)} to convert the correct argument
+ * and {@link #getConditionResult(Object)} to verify that the parsed object validate the additional
+ * conditions.
*
* @param