mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-02 17:00:41 +01:00
Added CommandSyntax#getSyntaxString
This commit is contained in:
parent
b0afadf093
commit
41d61e7df6
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -68,4 +68,8 @@ public class ArgumentEnum<E extends Enum> extends Argument<E> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Enum<%s>", getId());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user