Added CommandSyntax#getSyntaxString

This commit is contained in:
TheMode 2021-04-25 10:46:10 +02:00
parent b0afadf093
commit 41d61e7df6
2 changed files with 14 additions and 0 deletions

View File

@ -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();
}
}

View File

@ -68,4 +68,8 @@ public class ArgumentEnum<E extends Enum> extends Argument<E> {
}
}
@Override
public String toString() {
return String.format("Enum<%s>", getId());
}
}