Class LiteralArgument

java.lang.Object
dev.jorel.commandapi.AbstractArgumentTree<Impl,Argument,CommandSender>
dev.jorel.commandapi.arguments.AbstractArgument<T,Argument<T>,Argument<?>,org.bukkit.command.CommandSender>
dev.jorel.commandapi.arguments.Argument<String>
dev.jorel.commandapi.arguments.LiteralArgument
All Implemented Interfaces:
Literal<Argument<String>>, BukkitExecutable<Argument<String>>, ChainableBuilder<Argument<String>>, PlatformExecutable<Argument<String>,org.bukkit.command.CommandSender>

public class LiteralArgument extends Argument<String> implements Literal<Argument<String>>
A pseudo-argument representing a single literal string
Since:
1.3
  • Field Details

  • Constructor Details

    • LiteralArgument

      public LiteralArgument(String literal)
      A literal argument. Only takes one string value which cannot be modified
      Parameters:
      literal - the string literal that this argument will represent. Also acts as this argument's node name
    • LiteralArgument

      public LiteralArgument(String nodeName, String literal)
      A literal argument. Only takes one string value which cannot be modified
      Parameters:
      nodeName - the node name for this argument
      literal - the string literal that this argument will represent
  • Method Details

    • getPrimitiveType

      public Class<String> getPrimitiveType()
      Specified by:
      getPrimitiveType in class AbstractArgument<String,Argument<String>,Argument<?>,org.bukkit.command.CommandSender>
    • of

      public static LiteralArgument of(String literal)
      A utility method to create a literal argument. Works as an alternative to literal(String)

      To provide easier use of this method you can statically import this: import static dev.jorel.commandapi.arguments.LiteralArgument.of;

      Parameters:
      literal - the string literal that this argument will represent
      Returns:
      the literal argument created by this method
    • literal

      public static LiteralArgument literal(String literal)
      A utility method to create a literal argument. Works as an alternative to of(String)

      To provide easier use of this method you can statically import this: import static dev.jorel.commandapi.arguments.LiteralArgument.literal;

      Parameters:
      literal - the string literal that this argument will represent
      Returns:
      the literal argument created by this method
    • of

      public static LiteralArgument of(String nodeName, String literal)
      A utility method to create a literal argument. Works as an alternative to literal(String, String)

      To provide easier use of this method you can statically import this: import static dev.jorel.commandapi.arguments.LiteralArgument.of;

      Parameters:
      literal - the string literal that this argument will represent
      Returns:
      the literal argument created by this method
    • literal

      public static LiteralArgument literal(String nodeName, String literal)
      A utility method to create a literal argument. Works as an alternative to of(String, String)

      To provide easier use of this method you can statically import this: import static dev.jorel.commandapi.arguments.LiteralArgument.literal;

      Parameters:
      literal - the string literal that this argument will represent
      Returns:
      the literal argument created by this method
    • getLiteral

      public String getLiteral()
      Returns the literal string represented by this argument
      Specified by:
      getLiteral in interface Literal<Argument<String>>
      Returns:
      the literal string represented by this argument
    • getArgumentType

      public CommandAPIArgumentType getArgumentType()
      Specified by:
      getArgumentType in class AbstractArgument<String,Argument<String>,Argument<?>,org.bukkit.command.CommandSender>
    • parseArgument

      public <Source> String parseArgument(com.mojang.brigadier.context.CommandContext<Source> cmdCtx, String key, CommandArguments previousArgs) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Specified by:
      parseArgument in class AbstractArgument<String,Argument<String>,Argument<?>,org.bukkit.command.CommandSender>
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
    • getExecutor

      public CommandAPIExecutor<org.bukkit.command.CommandSender,AbstractCommandSender<? extends org.bukkit.command.CommandSender>> getExecutor()
    • setExecutor

      public void setExecutor(CommandAPIExecutor<org.bukkit.command.CommandSender,AbstractCommandSender<? extends org.bukkit.command.CommandSender>> arg0)
    • clearExecutors

      public Argument<String> clearExecutors()