Class PropExprSize
java.lang.Object
ch.njol.skript.lang.util.SimpleExpression<Object>
org.skriptlang.skript.lang.properties.PropertyBaseExpression<PropertyHandler.ExpressionPropertyHandler<?,?>>
org.skriptlang.skript.common.properties.expressions.PropExprSize
- All Implemented Interfaces:
Debuggable,Expression<Object>,Loopable<Object>,Simplifiable<Expression<? extends Object>>,SyntaxElement,PropertyBaseSyntax<PropertyHandler.ExpressionPropertyHandler<?,,?>> RuntimeErrorProducer,SyntaxRuntimeErrorProducer
@Name("Size")
@Description("The size of something.\nUsing \'size of {list::*}\' will return the length of the list, so if you want the sizes of the things inside the lists, use \'sizes of {list::*}\'.\n")
@Example("message \"There are %size of all players% players online!\"")
@Since({"1.0","2.13 (sizes of)"})
@RelatedProperty("size")
public class PropExprSize
extends PropertyBaseExpression<PropertyHandler.ExpressionPropertyHandler<?,?>>
-
Field Summary
Fields inherited from class org.skriptlang.skript.lang.properties.PropertyBaseExpression
expr, properties, property, returnType, returnTypes, useCIP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClass<?> @Nullable []Tests whether this expression supports the given mode, and if yes what type it expects thedeltato be.protected Object @Nullable []get(org.bukkit.event.Event event) This is the internal method to get an expression's values.
To get the expression's value from the outside useSimpleExpression.getSingle(Event)orSimpleExpression.getArray(Event).@NotNull Property<PropertyHandler.ExpressionPropertyHandler<?, ?>> Gets the property this expression represents.Class<?> Gets the return type of this expression.booleaninit(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) Called just after the constructor andSyntaxElement.preInit().booleanisSingle()Class<?>[]For expressions that might return multiple (incalculable at parse time) types, this provides a list of all possible types.toString(org.bukkit.event.Event event, boolean debug) Methods inherited from class org.skriptlang.skript.lang.properties.PropertyBaseExpression
change, convert, getPropertyReturnTypes, registerMethods inherited from class ch.njol.skript.lang.util.SimpleExpression
check, check, check, getAll, getAnd, getArray, getConvertedExpr, getConvertedExpression, getNode, getSingle, getSource, getTime, isDefault, isLoopOf, iterator, preInit, setTime, setTime, setTime, setTime, setTime, simplify, supportsLoopPeeking, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.njol.skript.lang.Expression
beforeChange, canBeSingle, canReturn, changeInPlace, changeInPlace, getAcceptedChangeModes, getOptionalSingle, getSyntaxTypeName, stream, streamAllMethods inherited from interface org.skriptlang.skript.lang.properties.PropertyBaseSyntax
getBadTypesErrorMessage, getPropertyNameMethods inherited from interface org.skriptlang.skript.log.runtime.RuntimeErrorProducer
error, error, getRuntimeErrorManager, warning, warningMethods inherited from interface ch.njol.skript.lang.SyntaxElement
getParserMethods inherited from interface org.skriptlang.skript.log.runtime.SyntaxRuntimeErrorProducer
getErrorSource
-
Constructor Details
-
PropExprSize
public PropExprSize()
-
-
Method Details
-
init
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) Description copied from interface:SyntaxElementCalled just after the constructor andSyntaxElement.preInit().- Specified by:
initin interfaceSyntaxElement- Overrides:
initin classPropertyBaseExpression<PropertyHandler.ExpressionPropertyHandler<?,?>> - Parameters:
expressions- all %expr%s included in the matching pattern in the order they appear in the pattern. If an optional value was left out, it will still be included in this list holding the default value of the desired type, which usually depends on the event.matchedPattern- The index of the pattern which matchedisDelayed- Whether this expression is used after a delay or not (i.e. if the event has already passed when this expression will be called)parseResult- Additional information about the match.- Returns:
- Whether this expression was initialised successfully. An error should be printed prior to returning false to specify the cause.
- See Also:
-
get
Description copied from class:SimpleExpressionThis is the internal method to get an expression's values.
To get the expression's value from the outside useSimpleExpression.getSingle(Event)orSimpleExpression.getArray(Event).- Overrides:
getin classPropertyBaseExpression<PropertyHandler.ExpressionPropertyHandler<?,?>> - Parameters:
event- The event with which this expression is evaluated.- Returns:
- An array of values for this event. May not contain nulls.
-
acceptChange
Description copied from interface:ExpressionTests whether this expression supports the given mode, and if yes what type it expects thedeltato be.Use
Changer.ChangerUtils.acceptsChange(Expression, ChangeMode, Class...)to test whether an expression supports changing, don't directly use this method!Please note that if a changer is registered for this expression's
returnTypethis method does not have to be overridden. If you override it though make sure to return super.acceptChange(mode), and to handle the appropriate ChangeMode(s) inExpression.change(Event, Object[], ChangeMode)with super.change(...).Unlike
Changer.acceptChange(ChangeMode)this method may print errors.- Specified by:
acceptChangein interfaceExpression<Object>- Overrides:
acceptChangein classPropertyBaseExpression<PropertyHandler.ExpressionPropertyHandler<?,?>> - Parameters:
mode- The mode to check- Returns:
- An array of types that
Expression.change(Event, Object[], ChangeMode)accepts as itsdeltaparameter (which can be arrays to denote that multiple of that type are accepted), or null if the given mode is not supported. ForChanger.ChangeMode.DELETEandChanger.ChangeMode.RESETthis can return any non-null array to mark them as supported.
-
getProperty
Description copied from interface:PropertyBaseSyntaxGets the property this expression represents. This is used to find the appropriate handlers for the expression's input types.- Returns:
- The property this expression represents.
-
isSingle
public boolean isSingle()- Specified by:
isSinglein interfaceExpression<Object>- Overrides:
isSinglein classPropertyBaseExpression<PropertyHandler.ExpressionPropertyHandler<?,?>> - Returns:
- true if this expression will ever only return one value at most, false if it can return multiple values.
-
getReturnType
Description copied from interface:ExpressionGets the return type of this expression.- Specified by:
getReturnTypein interfaceExpression<Object>- Overrides:
getReturnTypein classPropertyBaseExpression<PropertyHandler.ExpressionPropertyHandler<?,?>> - Returns:
- A supertype of any objects returned by
Expression.getSingle(Event)and the component type of any arrays returned byExpression.getArray(Event)
-
possibleReturnTypes
Description copied from interface:ExpressionFor expressions that might return multiple (incalculable at parse time) types, this provides a list of all possible types. Use cases include: expressions that depend on the return type of their input.- Specified by:
possibleReturnTypesin interfaceExpression<Object>- Overrides:
possibleReturnTypesin classPropertyBaseExpression<PropertyHandler.ExpressionPropertyHandler<?,?>> - Returns:
- A list of all possible types this might return
-
toString
- Specified by:
toStringin interfaceDebuggable- Overrides:
toStringin classPropertyBaseExpression<PropertyHandler.ExpressionPropertyHandler<?,?>> - 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
-