Package ch.njol.skript.lang
Class LiteralString
java.lang.Object
ch.njol.skript.lang.VariableString
ch.njol.skript.lang.LiteralString
- All Implemented Interfaces:
Debuggable
,Expression<String>
,Literal<String>
,SyntaxElement
-
Field Summary
Fields inherited from class ch.njol.skript.lang.VariableString
original
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
LiteralString
(String input) Creates a new VariableString which does not contain variables. -
Method Summary
Modifier and TypeMethodDescriptionString[]
getAll()
String[]
getArray()
<R> @Nullable Literal
<? extends R> getConvertedExpression
(Class<R>... to) Tries to convert this expression to the given type.getOptionalSingle
(org.bukkit.event.Event event) Get an optional of the single value of this expression.toString
(@Nullable org.bukkit.event.Event event, boolean debug) UseVariableString.toString(Event)
to get the actual string.Methods inherited from class ch.njol.skript.lang.VariableString
acceptChange, change, check, check, getAll, getAnd, getArray, getDefaultVariableNames, getMessageComponents, getMessageComponentsUnsafe, getMode, getReturnType, getSingle, getSource, getTime, init, isDefault, isLoopOf, isQuotedCorrectly, isSimple, isSingle, iterator, makeStrings, makeStringsFromQuoted, newInstance, newInstance, nextVariableBracket, quote, setMode, setStringMode, setTime, simplify, toChatString, toString, toString, toUnformattedString, unquote
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.njol.skript.lang.Debuggable
toString
Methods inherited from interface ch.njol.skript.lang.Expression
acceptChange, beforeChange, canBeSingle, canReturn, change, check, check, getAcceptedChangeModes, getAll, getAnd, getArray, getReturnType, getSingle, getSource, getTime, isDefault, isLoopOf, isSingle, iterator, possibleReturnTypes, setTime, simplify, stream
Methods inherited from interface ch.njol.skript.lang.SyntaxElement
getParser, init
-
Constructor Details
-
LiteralString
Creates a new VariableString which does not contain variables.- Parameters:
input
- Content for string.
-
-
Method Details
-
getArray
-
getSingle
-
getAll
-
getOptionalSingle
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 interfaceExpression<String>
- Parameters:
event
- the event- Returns:
- an
Optional
containing thesingle value
of this expression for this event. - See Also:
-
getConvertedExpression
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 interfaceExpression<String>
- Specified by:
getConvertedExpression
in interfaceLiteral<String>
- Overrides:
getConvertedExpression
in classVariableString
- 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
UseVariableString.toString(Event)
to get the actual string. This method is for debugging.- Specified by:
toString
in interfaceDebuggable
- Overrides:
toString
in classVariableString
- 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
-