Class PropExprNumber
java.lang.Object
ch.njol.skript.lang.util.SimpleExpression<Object>
org.skriptlang.skript.lang.properties.PropertyBaseExpression<PropertyHandler.ExpressionPropertyHandler<?,?>>
org.skriptlang.skript.common.properties.expressions.PropExprNumber
- All Implemented Interfaces:
Debuggable
,Expression<Object>
,Loopable<Object>
,Simplifiable<Expression<? extends Object>>
,SyntaxElement
,PropertyBaseSyntax<PropertyHandler.ExpressionPropertyHandler<?,
,?>> RuntimeErrorProducer
,SyntaxRuntimeErrorProducer
@Name("Number Of")
@Description("The number of something.\nUsing \'number of {list::*}\' will return the length of the list, so if you want the numbers of the things inside the lists, use \'numbers of {list::*}\'.\n")
@Example("message \"There are %number of all players% players online!\"")
@Since({"1.0","2.13 (numbers of)"})
@RelatedProperty("number")
public class PropExprNumber
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 thedelta
to 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.boolean
init
(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) Called just after the constructor andSyntaxElement.preInit()
.boolean
isSingle()
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, register
Methods 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, 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.Expression
beforeChange, canBeSingle, canReturn, changeInPlace, changeInPlace, getAcceptedChangeModes, getOptionalSingle, getSyntaxTypeName, stream, streamAll
Methods inherited from interface org.skriptlang.skript.lang.properties.PropertyBaseSyntax
getBadTypesErrorMessage, getPropertyName
Methods inherited from interface org.skriptlang.skript.log.runtime.RuntimeErrorProducer
error, error, getRuntimeErrorManager, warning, warning
Methods inherited from interface ch.njol.skript.lang.SyntaxElement
getParser
Methods inherited from interface org.skriptlang.skript.log.runtime.SyntaxRuntimeErrorProducer
getErrorSource
-
Constructor Details
-
PropExprNumber
public PropExprNumber()
-
-
Method Details
-
init
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) Description copied from interface:SyntaxElement
Called just after the constructor andSyntaxElement.preInit()
.- Specified by:
init
in interfaceSyntaxElement
- Overrides:
init
in 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:SimpleExpression
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)
.- Overrides:
get
in 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:Expression
Tests whether this expression supports the given mode, and if yes what type it expects thedelta
to 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
returnType
this 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:
acceptChange
in interfaceExpression<Object>
- Overrides:
acceptChange
in classPropertyBaseExpression<PropertyHandler.ExpressionPropertyHandler<?,
?>> - Parameters:
mode
- The mode to check- Returns:
- An array of types that
Expression.change(Event, Object[], ChangeMode)
accepts as itsdelta
parameter (which can be arrays to denote that multiple of that type are accepted), or null if the given mode is not supported. ForChanger.ChangeMode.DELETE
andChanger.ChangeMode.RESET
this can return any non-null array to mark them as supported.
-
getProperty
Description copied from interface:PropertyBaseSyntax
Gets 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:
isSingle
in interfaceExpression<Object>
- Overrides:
isSingle
in 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:Expression
Gets the return type of this expression.- Specified by:
getReturnType
in interfaceExpression<Object>
- Overrides:
getReturnType
in 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:Expression
For 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:
possibleReturnTypes
in interfaceExpression<Object>
- Overrides:
possibleReturnTypes
in classPropertyBaseExpression<PropertyHandler.ExpressionPropertyHandler<?,
?>> - Returns:
- A list of all possible types this might return
-
toString
- Specified by:
toString
in interfaceDebuggable
- Overrides:
toString
in 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
-