Package ch.njol.skript.lang
Class LiteralList<T>
java.lang.Object
ch.njol.skript.lang.ExpressionList<T>
ch.njol.skript.lang.LiteralList<T>
- All Implemented Interfaces:
Debuggable
,Expression<T>
,Literal<T>
,SyntaxElement
A list of literals. Can contain
UnparsedLiteral
s.-
Field Summary
Fields inherited from class ch.njol.skript.lang.ExpressionList
and, expressions
-
Constructor Summary
ConstructorDescriptionLiteralList
(Literal<? extends T>[] literals, Class<T> returnType, boolean and) LiteralList
(Literal<? extends T>[] literals, Class<T> returnType, boolean and, LiteralList<?> source) LiteralList
(Literal<? extends T>[] literals, Class<T> returnType, Class<?>[] possibleReturnTypes, boolean and) LiteralList
(Literal<? extends T>[] literals, Class<T> returnType, Class<?>[] possibleReturnTypes, boolean and, LiteralList<?> source) -
Method Summary
Methods inherited from class ch.njol.skript.lang.ExpressionList
acceptChange, change, check, check, getAll, getAnd, getArray, getReturnType, getSingle, getSource, getTime, init, invertAnd, isDefault, isLoopOf, isSingle, iterator, possibleReturnTypes, setTime, toString, toString
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, toString
Methods inherited from interface ch.njol.skript.lang.Expression
acceptChange, beforeChange, canBeSingle, canReturn, change, changeInPlace, changeInPlace, check, check, getAcceptedChangeModes, getAll, getAnd, getArray, getOptionalSingle, getReturnType, getSingle, getSource, getTime, isDefault, isLoopOf, isSingle, iterator, possibleReturnTypes, setTime, stream
Methods inherited from interface ch.njol.skript.lang.SyntaxElement
getParser, init
-
Constructor Details
-
LiteralList
-
LiteralList
-
LiteralList
public LiteralList(Literal<? extends T>[] literals, Class<T> returnType, boolean and, LiteralList<?> source) -
LiteralList
-
-
Method Details
-
getArray
-
getSingle
-
getAll
-
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<T>
- Specified by:
getConvertedExpression
in interfaceLiteral<T>
- Overrides:
getConvertedExpression
in classExpressionList<T>
- 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:
-
getExpressions
- Overrides:
getExpressions
in classExpressionList<T>
- Returns:
- The internal list of expressions. Can be modified with care.
-
simplify
Description copied from interface:Expression
Simplifies the expression, e.g. if it only contains literals the expression may be simplified to a literal, and wrapped expressions are unwrapped.After this method was used the toString methods are likely not useful anymore.
This method is not yet used but will be used to improve efficiency in the future.
- Specified by:
simplify
in interfaceExpression<T>
- Overrides:
simplify
in classExpressionList<T>
- Returns:
- A reference to a simpler version of this expression. Can change this expression directly and return itself if applicable, i.e. no references to the expression before this method call should be kept!
-