Class IntegerArgument

java.lang.Object
me.efekos.simpler.commands.syntax.Argument
me.efekos.simpler.commands.syntax.impl.IntegerArgument

public class IntegerArgument extends Argument
An example extension of custom Arguments: This argument can be any integer, or an integer in a range.
  • Constructor Details

    • IntegerArgument

      public IntegerArgument(String holder, ArgumentPriority priority, int min, int max)
      Crates an instance of IntegerArgument.
      Parameters:
      holder - Placeholder of the argument.
      priority - Priority of the argument.
      min - Minimum value.
      max - Maximum value.
    • IntegerArgument

      public IntegerArgument(String holder, ArgumentPriority priority)
      Crates an instance of IntegerArgument.
      Parameters:
      holder - Placeholder of the argument.
      priority - Priority of the argument.
  • Method Details

    • getPlaceHolder

      public String getPlaceHolder()
      Returns a short placeholder to represent this argument. However, Argument.toString() is more recommended than this method if you want to represent this argument as a String.
      Specified by:
      getPlaceHolder in class Argument
      Returns:
      The placeholder of this argument. Placeholder is usually a one-word string that represents what this argument should be. For example: <player> argument should be the name of an OfflinePlayer. We are able to understand this, because that argument's placeholder is "player", meaning we should enter someone's name there.
    • getList

      public List<String> getList(org.bukkit.entity.Player player, String current)
      Generates a list of suggestions about this argument.
      Specified by:
      getList in class Argument
      Parameters:
      player - Player who needs suggestions for this argument.
      current - Current string player entered so far.
      Returns:
      List of the strings player will see.
    • getPriority

      public ArgumentPriority getPriority()
      Returns a priority about this argument.
      Specified by:
      getPriority in class Argument
      Returns:
      Priority of this argument. You can make your argument an optional or required argument using this.
    • handleCorrection

      public ArgumentHandleResult handleCorrection(String given)
      Makes sure that the argument player wrote is valid.
      Specified by:
      handleCorrection in class Argument
      Parameters:
      given - The string that someone wrote as a value for this argument
      Returns:
      Is the given argument valid?