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 a9ee4238a..5a5a7a5cc 100644 --- a/src/main/java/net/minestom/server/command/builder/CommandSyntax.java +++ b/src/main/java/net/minestom/server/command/builder/CommandSyntax.java @@ -3,6 +3,7 @@ package net.minestom.server.command.builder; import net.minestom.server.command.builder.arguments.Argument; import net.minestom.server.command.builder.condition.CommandCondition; import net.minestom.server.entity.Player; +import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -103,4 +104,13 @@ public class CommandSyntax { public boolean hasSuggestion() { return suggestion; } + + public @NotNull String getSyntaxString() { + StringBuilder builder = new StringBuilder(); + for (Argument argument : args) { + builder.append(argument.toString()) + .append(StringUtils.SPACE); + } + return builder.toString().trim(); + } } diff --git a/src/main/java/net/minestom/server/command/builder/arguments/ArgumentEnum.java b/src/main/java/net/minestom/server/command/builder/arguments/ArgumentEnum.java index 9cafbda11..723842555 100644 --- a/src/main/java/net/minestom/server/command/builder/arguments/ArgumentEnum.java +++ b/src/main/java/net/minestom/server/command/builder/arguments/ArgumentEnum.java @@ -68,4 +68,8 @@ public class ArgumentEnum extends Argument { } } + @Override + public String toString() { + return String.format("Enum<%s>", getId()); + } }