Class WrappedBrigadierParser<C,T>

java.lang.Object
org.incendo.cloud.brigadier.parser.WrappedBrigadierParser<C,T>
Type Parameters:
C - command sender type
T - value type
All Implemented Interfaces:
org.incendo.cloud.parser.ArgumentParser<C,T>, org.incendo.cloud.suggestion.SuggestionProvider<C>, org.incendo.cloud.suggestion.SuggestionProviderHolder<C>

public class WrappedBrigadierParser<C,T> extends Object implements org.incendo.cloud.parser.ArgumentParser<C,T>, org.incendo.cloud.suggestion.SuggestionProvider<C>
A wrapped argument parser adapting Brigadier argument types.
Since:
1.5.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Function which can call ArgumentType.parse(StringReader) or another method.

    Nested classes/interfaces inherited from interface org.incendo.cloud.parser.ArgumentParser

    org.incendo.cloud.parser.ArgumentParser.FutureArgumentParser<C extends Object,T extends Object>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    WrappedBrigadierParser(com.mojang.brigadier.arguments.ArgumentType<T> argumentType)
    Create an argument parser from a Brigadier ArgumentType.
    WrappedBrigadierParser(Supplier<com.mojang.brigadier.arguments.ArgumentType<T>> argumentTypeSupplier)
    Create a WrappedBrigadierParser for the argument type.
    WrappedBrigadierParser(Supplier<com.mojang.brigadier.arguments.ArgumentType<T>> argumentTypeSupplier, @Nullable WrappedBrigadierParser.ParseFunction<T> parse)
    Create an argument parser from a Brigadier ArgumentType.
  • Method Summary

    Modifier and Type
    Method
    Description
    final com.mojang.brigadier.arguments.ArgumentType<T>
    Returns the backing Brigadier ArgumentType for this parser.
    final @NonNull org.incendo.cloud.parser.ArgumentParseResult<@NonNull T>
    parse(@NonNull org.incendo.cloud.context.CommandContext<@NonNull C> commandContext, @NonNull org.incendo.cloud.context.CommandInput commandInput)
     
    final @NonNull CompletableFuture<@NonNull Iterable<@NonNull org.incendo.cloud.suggestion.Suggestion>>
    suggestionsFuture(@NonNull org.incendo.cloud.context.CommandContext<C> commandContext, @NonNull org.incendo.cloud.context.CommandInput input)
     

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.incendo.cloud.parser.ArgumentParser

    flatMap, flatMapSuccess, mapSuccess, parseFuture, suggestionProvider
  • 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> argumentType)
      Create an argument parser from a Brigadier ArgumentType.
      Parameters:
      argumentType - Brigadier argument type
      Since:
      1.5.0
    • WrappedBrigadierParser

      public WrappedBrigadierParser(Supplier<com.mojang.brigadier.arguments.ArgumentType<T>> argumentTypeSupplier)
      Create a WrappedBrigadierParser for the argument type.
      Parameters:
      argumentTypeSupplier - Brigadier argument type supplier
      Since:
      1.7.0
    • WrappedBrigadierParser

      @API(status=STABLE, since="2.0.0") public WrappedBrigadierParser(Supplier<com.mojang.brigadier.arguments.ArgumentType<T>> argumentTypeSupplier, @Nullable WrappedBrigadierParser.ParseFunction<T> parse)
      Create an argument parser from a Brigadier ArgumentType.
      Parameters:
      argumentTypeSupplier - Brigadier argument type supplier
      parse - special function to replace ArgumentType.parse(StringReader) (for CraftBukkit weirdness)
      Since:
      2.0.0
  • Method Details

    • nativeArgumentType

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

      public final @NonNull org.incendo.cloud.parser.ArgumentParseResult<@NonNull T> parse(@NonNull org.incendo.cloud.context.CommandContext<@NonNull C> commandContext, @NonNull org.incendo.cloud.context.CommandInput commandInput)
      Specified by:
      parse in interface org.incendo.cloud.parser.ArgumentParser<C,T>
    • suggestionsFuture

      public final @NonNull CompletableFuture<@NonNull Iterable<@NonNull org.incendo.cloud.suggestion.Suggestion>> suggestionsFuture(@NonNull org.incendo.cloud.context.CommandContext<C> commandContext, @NonNull org.incendo.cloud.context.CommandInput input)
      Specified by:
      suggestionsFuture in interface org.incendo.cloud.suggestion.SuggestionProvider<C>