Class StringContext<T extends me.lucyy.squirtgun.platform.PermissionHolder>

java.lang.Object
me.lucyy.squirtgun.command.context.StringContext<T>
All Implemented Interfaces:
CommandContext<T>

public class StringContext<T extends me.lucyy.squirtgun.platform.PermissionHolder>
extends java.lang.Object
implements CommandContext<T>
A command context that parses a raw string.
  • Constructor Summary

    Constructors
    Constructor Description
    StringContext​(me.lucyy.squirtgun.format.FormatProvider provider, T target, CommandNode<T> node, java.lang.String value)  
  • Method Summary

    Modifier and Type Method Description
    net.kyori.adventure.text.Component execute()
    Executes the command.
    @Nullable java.lang.Object getArgumentValue​(java.lang.String name)
    Gets the value of an argument by name.
    <U> U getArgumentValue​(CommandArgument<U> name)
    Gets the value of an argument.
    @NotNull me.lucyy.squirtgun.format.FormatProvider getFormat()
    Gets the format provider to use in message decoration.
    java.lang.String getRaw()
    Gets the raw input given to this context.
    CommandNode<T> getTail()
    Gets the last node in the chain that has been reached.
    T getTarget()
    Gets this command context's target.
    java.util.List<java.lang.String> tabComplete()
    Gets the string to be shown in the tabcompleter.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StringContext

      public StringContext​(me.lucyy.squirtgun.format.FormatProvider provider, T target, CommandNode<T> node, java.lang.String value)
  • Method Details

    • getTarget

      public T getTarget()
      Description copied from interface: CommandContext
      Gets this command context's target.
      Specified by:
      getTarget in interface CommandContext<T extends me.lucyy.squirtgun.platform.PermissionHolder>
    • getArgumentValue

      @Nullable public <U> U getArgumentValue​(CommandArgument<U> name)
      Description copied from interface: CommandContext
      Gets the value of an argument.
      Specified by:
      getArgumentValue in interface CommandContext<T extends me.lucyy.squirtgun.platform.PermissionHolder>
      Parameters:
      name - the argument to get the value for
      Returns:
      the value if available - if unset then null
    • getArgumentValue

      @Nullable public @Nullable java.lang.Object getArgumentValue​(java.lang.String name)
      Description copied from interface: CommandContext
      Gets the value of an argument by name.
      Specified by:
      getArgumentValue in interface CommandContext<T extends me.lucyy.squirtgun.platform.PermissionHolder>
      Parameters:
      name - the name of the argument to get the value for
      Returns:
      the value if available, if unset then null.
    • getRaw

      public java.lang.String getRaw()
      Description copied from interface: CommandContext
      Gets the raw input given to this context.
      Specified by:
      getRaw in interface CommandContext<T extends me.lucyy.squirtgun.platform.PermissionHolder>
    • getFormat

      @NotNull public @NotNull me.lucyy.squirtgun.format.FormatProvider getFormat()
      Description copied from interface: CommandContext
      Gets the format provider to use in message decoration.
      Specified by:
      getFormat in interface CommandContext<T extends me.lucyy.squirtgun.platform.PermissionHolder>
    • tabComplete

      public java.util.List<java.lang.String> tabComplete()
      Description copied from interface: CommandContext
      Gets the string to be shown in the tabcompleter.
      Specified by:
      tabComplete in interface CommandContext<T extends me.lucyy.squirtgun.platform.PermissionHolder>
    • execute

      public net.kyori.adventure.text.Component execute()
      Description copied from interface: CommandContext
      Executes the command.
      Specified by:
      execute in interface CommandContext<T extends me.lucyy.squirtgun.platform.PermissionHolder>
    • getTail

      public CommandNode<T> getTail()
      Description copied from interface: CommandContext
      Gets the last node in the chain that has been reached.
      Specified by:
      getTail in interface CommandContext<T extends me.lucyy.squirtgun.platform.PermissionHolder>