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>,Loopable<T>,Simplifiable<Expression<? extends T>>,SyntaxElement
A list of literals. Can contain
UnparsedLiterals.-
Field Summary
Fields inherited from class ch.njol.skript.lang.ExpressionList
and, expressions -
Constructor Summary
ConstructorsConstructorDescriptionLiteralList(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, changeInPlace, check, check, getAll, getAllExpressions, getAnd, getArray, getReturnType, getSingle, getSource, getTime, init, invertAnd, isDefault, isLoopOf, isSingle, iterator, possibleReturnTypes, setTime, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.njol.skript.lang.Debuggable
toString, toStringMethods 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, getSyntaxTypeName, getTime, isDefault, isSingle, possibleReturnTypes, setTime, stream, streamAllMethods inherited from interface ch.njol.skript.lang.Loopable
isLoopOf, iterator, supportsLoopPeekingMethods inherited from interface ch.njol.skript.lang.SyntaxElement
getParser, init, preInit
-
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:ExpressionTries 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
returnTypeis 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:
getConvertedExpressionin interfaceExpression<T>- Specified by:
getConvertedExpressionin interfaceLiteral<T>- Overrides:
getConvertedExpressionin 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:
getExpressionsin classExpressionList<T>- Returns:
- The internal list of expressions. Can be modified with care.
-
simplify
Description copied from interface:SimplifiableSimplifies this object. This should be called immediately after init() returns true. If simplification is not possible, the object is returned as is.
References to the original object should be replaced with the simplified object.
Any returned object should attempt to maintain the original value ofDebuggable.toString(Event, boolean). An addition indicating that the value was simplified can be added in the debug string. SeeSimplifiedLiteralfor an example.
Simplification should never invalidate contracts. For example, any simplified expression should take care to return the same or a more specific type than the original expression, never a more generic type. Likewise, be sure to maintain the behavior of change() and acceptsChange(). Failure to do so can result in unexpected behavior and tricky bugs.
Finally, simplified results should updateExpression.getSource()to point to the expression prior to simplification. This makes maintaining the above contracts easier.- Specified by:
simplifyin interfaceExpression<T>- Specified by:
simplifyin interfaceSimplifiable<T>- Overrides:
simplifyin classExpressionList<T>- Returns:
- the simplified object.
- See Also:
-