Class WrappedBrigadierParser<C,T>

java.lang.Object
cloud.commandframework.brigadier.argument.WrappedBrigadierParser<C,T>
Type Parameters:
C - the sender type
T - the value type of the argument
All Implemented Interfaces:
cloud.commandframework.arguments.parser.ArgumentParser<C,T>

public final class WrappedBrigadierParser<C,T> extends Object implements cloud.commandframework.arguments.parser.ArgumentParser<C,T>
A wrapped argument parser that can expose Brigadier argument types to the Cloud world.
Since:
1.5.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from interface cloud.commandframework.arguments.parser.ArgumentParser

    DEFAULT_ARGUMENT_COUNT
  • Constructor Summary

    Constructors
    Constructor
    Description
    WrappedBrigadierParser(com.mojang.brigadier.arguments.ArgumentType<T> nativeType)
    Create an argument parser based on a brigadier command.
    WrappedBrigadierParser(com.mojang.brigadier.arguments.ArgumentType<T> nativeType, int expectedArgumentCount)
    Create an argument parser based on a brigadier command.
    WrappedBrigadierParser(Supplier<com.mojang.brigadier.arguments.ArgumentType<T>> nativeType)
    Create an argument parser based on a brigadier command.
    WrappedBrigadierParser(Supplier<com.mojang.brigadier.arguments.ArgumentType<T>> nativeType, int expectedArgumentCount)
    Create an argument parser based on a brigadier command.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.mojang.brigadier.arguments.ArgumentType<T>
    Get the backing Brigadier ArgumentType for this parser.
    int
     
    boolean
     
    @NonNull cloud.commandframework.arguments.parser.ArgumentParseResult<@NonNull T>
    parse(@NonNull cloud.commandframework.context.CommandContext<@NonNull C> commandContext, @NonNull Queue<@NonNull String> inputQueue)
     
    @NonNull List<@NonNull String>
    suggestions(@NonNull cloud.commandframework.context.CommandContext<C> commandContext, @NonNull String input)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface cloud.commandframework.arguments.parser.ArgumentParser

    map
  • Field Details

    • COMMAND_CONTEXT_BRIGADIER_NATIVE_SENDER

      public static final String COMMAND_CONTEXT_BRIGADIER_NATIVE_SENDER
      See Also:
  • Constructor Details

    • WrappedBrigadierParser

      public WrappedBrigadierParser(com.mojang.brigadier.arguments.ArgumentType<T> nativeType)
      Create an argument parser based on a brigadier command.
      Parameters:
      nativeType - the native command type
      Since:
      1.5.0
    • WrappedBrigadierParser

      public WrappedBrigadierParser(Supplier<com.mojang.brigadier.arguments.ArgumentType<T>> nativeType)
      Create an argument parser based on a brigadier command.
      Parameters:
      nativeType - the native command type, computed lazily
      Since:
      1.7.0
    • WrappedBrigadierParser

      public WrappedBrigadierParser(com.mojang.brigadier.arguments.ArgumentType<T> nativeType, int expectedArgumentCount)
      Create an argument parser based on a brigadier command.
      Parameters:
      nativeType - the native command type
      expectedArgumentCount - the number of arguments the brigadier type is expected to consume
      Since:
      1.5.0
    • WrappedBrigadierParser

      public WrappedBrigadierParser(Supplier<com.mojang.brigadier.arguments.ArgumentType<T>> nativeType, int expectedArgumentCount)
      Create an argument parser based on a brigadier command.
      Parameters:
      nativeType - the native command type provider, calculated lazily
      expectedArgumentCount - the number of arguments the brigadier type is expected to consume
      Since:
      1.7.0
  • Method Details

    • getNativeArgument

      public com.mojang.brigadier.arguments.ArgumentType<T> getNativeArgument()
      Get the backing Brigadier ArgumentType for this parser.
      Returns:
      the argument type
      Since:
      1.5.0
    • parse

      public @NonNull cloud.commandframework.arguments.parser.ArgumentParseResult<@NonNull T> parse(@NonNull cloud.commandframework.context.CommandContext<@NonNull C> commandContext, @NonNull Queue<@NonNull String> inputQueue)
      Specified by:
      parse in interface cloud.commandframework.arguments.parser.ArgumentParser<C,T>
    • suggestions

      public @NonNull List<@NonNull String> suggestions(@NonNull cloud.commandframework.context.CommandContext<C> commandContext, @NonNull String input)
      Specified by:
      suggestions in interface cloud.commandframework.arguments.parser.ArgumentParser<C,T>
    • isContextFree

      public boolean isContextFree()
      Specified by:
      isContextFree in interface cloud.commandframework.arguments.parser.ArgumentParser<C,T>
    • getRequestedArgumentCount

      public int getRequestedArgumentCount()
      Specified by:
      getRequestedArgumentCount in interface cloud.commandframework.arguments.parser.ArgumentParser<C,T>