Class LiteralString

java.lang.Object
ch.njol.skript.lang.VariableString
ch.njol.skript.lang.LiteralString
All Implemented Interfaces:
Debuggable, Expression<String>, Literal<String>, SyntaxElement

public class LiteralString extends VariableString implements Literal<String>
  • Constructor Details

    • LiteralString

      protected LiteralString(String input)
      Creates a new VariableString which does not contain variables.
      Parameters:
      input - Content for string.
  • Method Details

    • getArray

      public String[] getArray()
      Specified by:
      getArray in interface Literal<String>
    • getSingle

      public String getSingle()
      Specified by:
      getSingle in interface Literal<String>
    • getAll

      public String[] getAll()
      Specified by:
      getAll in interface Literal<String>
    • getOptionalSingle

      public Optional<String> getOptionalSingle(org.bukkit.event.Event event)
      Description copied from interface: Expression
      Get an optional of the single value of this expression.

      Do not use this in conditions, use Expression.check(Event, Checker, boolean) instead.

      Specified by:
      getOptionalSingle in interface Expression<String>
      Parameters:
      event - the event
      Returns:
      an Optional containing the single value of this expression for this event.
      See Also:
    • getConvertedExpression

      @Nullable public <R> @Nullable Literal<? extends R> getConvertedExpression(Class<R>... to)
      Description copied from interface: Expression
      Tries to convert this expression to the given type. This method can print an error prior to returning null to specify the cause.

      Please note that expressions whose returnType is not Object will not be parsed at all for a certain class if there's no converter from the expression's returnType to the desired class. Thus this method should only be overridden if this expression's returnType is Object.

      The returned expression should delegate this method to the original expression's method to prevent excessive converted expression chains (see also ConvertedExpression).

      Specified by:
      getConvertedExpression in interface Expression<String>
      Specified by:
      getConvertedExpression in interface Literal<String>
      Overrides:
      getConvertedExpression in class VariableString
      Parameters:
      to - The desired return type of the returned expression
      Returns:
      Expression with the desired return type or null if the expression can't be converted to the given type. Returns the expression itself if it already returns the desired type.
      See Also:
    • toString

      public String toString(@Nullable @Nullable org.bukkit.event.Event event, boolean debug)
      Use VariableString.toString(Event) to get the actual string. This method is for debugging.
      Specified by:
      toString in interface Debuggable
      Overrides:
      toString in class VariableString
      Parameters:
      event - The event to get information from. This is always null if debug == false.
      debug - If true this should print more information, if false this should print what is shown to the end user
      Returns:
      String representation of this object