Class EnumArgument2<T extends Enum<T>>

java.lang.Object
org.moddingx.libx.command.EnumArgument2<T>
All Implemented Interfaces:
com.mojang.brigadier.arguments.ArgumentType<T>

public class EnumArgument2<T extends Enum<T>> extends Object implements com.mojang.brigadier.arguments.ArgumentType<T>
As the EnumArgument is sometimes a bit buggy because when the entered value is lowercase but the actual enum value is uppercase and it also does not sync properly, here's a variant that solves these issues.
  • Method Details

    • enumArgument

      public static <R extends Enum<R>> EnumArgument2<R> enumArgument(Class<R> enumClass)
      Creates a new enum argument for the given enum class.
    • parse

      public T parse(com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Specified by:
      parse in interface com.mojang.brigadier.arguments.ArgumentType<T extends Enum<T>>
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • listSuggestions

      public <S> CompletableFuture<com.mojang.brigadier.suggestion.Suggestions> listSuggestions(com.mojang.brigadier.context.CommandContext<S> context, com.mojang.brigadier.suggestion.SuggestionsBuilder builder)
      Specified by:
      listSuggestions in interface com.mojang.brigadier.arguments.ArgumentType<T extends Enum<T>>
    • getExamples

      public Collection<String> getExamples()
      Specified by:
      getExamples in interface com.mojang.brigadier.arguments.ArgumentType<T extends Enum<T>>