feat: cloop interval units (now we can loop at 1 chomeNS and crash the server :D)
feat: show possible values of the enum in the command context's `getEnum`
This commit is contained in:
@@ -232,7 +232,15 @@ public class CommandContext {
|
||||
try {
|
||||
return Enum.valueOf(enumClass, string.toUpperCase());
|
||||
} catch (IllegalArgumentException | NullPointerException e) {
|
||||
throw new CommandException(Component.text("Invalid enum"));
|
||||
final T[] values = enumClass.getEnumConstants();
|
||||
|
||||
throw new CommandException(
|
||||
Component.translatable(
|
||||
"Invalid %s. Possible values are: %s",
|
||||
Component.text(enumClass.getSimpleName()),
|
||||
Component.text(Arrays.toString(values))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user