Package ch.njol.skript.expressions
Class ExprTypeOf
java.lang.Object
ch.njol.skript.lang.util.SimpleExpression<T>
ch.njol.skript.expressions.base.PropertyExpression<F,T>
ch.njol.skript.expressions.base.SimplePropertyExpression<Object,Object>
ch.njol.skript.expressions.ExprTypeOf
- All Implemented Interfaces:
Converter<Object,Object>
,Debuggable
,Expression<Object>
,SyntaxElement
@Name("Type of")
@Description({"Type of a block, item, entity, inventory or potion effect.","Types of items and blocks are item types similar to them but have amounts","of one, no display names and, on Minecraft 1.13 and newer versions, are undamaged.","Types of entities and inventories are entity types and inventory types known to Skript.","Types of potion effects are potion effect types."})
@Examples({"on rightclick on an entity:","\tmessage \"This is a %type of clicked entity%!\""})
@Since("1.4, 2.5.2 (potion effect)")
public class ExprTypeOf
extends SimplePropertyExpression<Object,Object>
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.njol.skript.classes.Converter
Converter.ConverterInfo<F,T>, Converter.ConverterUtils
-
Field Summary
Fields inherited from interface ch.njol.skript.classes.Converter
NO_CHAINING, NO_COMMAND_ARGUMENTS, NO_LEFT_CHAINING, NO_RIGHT_CHAINING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable Object
Converts an object from the given to the desired type.protected <R> @Nullable ConvertedExpression<Object,? extends R>
getConvertedExpr(Class<R>... to)
Converts this expression to another type.protected String
Gets the return type of this expression.Methods inherited from class ch.njol.skript.expressions.base.SimplePropertyExpression
get, init, toString
Methods inherited from class ch.njol.skript.expressions.base.PropertyExpression
get, get, getAll, getAnd, getExpr, isSingle, register, setExpr, simplify
Methods inherited from class ch.njol.skript.lang.util.SimpleExpression
acceptChange, change, check, check, check, getArray, getConvertedExpression, getSingle, getSource, getTime, isDefault, isLoopOf, iterator, setTime, setTime, setTime, setTime, 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, stream
Methods inherited from interface ch.njol.skript.lang.SyntaxElement
getParser
-
Constructor Details
-
ExprTypeOf
public ExprTypeOf()
-
-
Method Details
-
getPropertyName
- Specified by:
getPropertyName
in classSimplePropertyExpression<Object,Object>
-
convert
Description copied from interface:Converter
Converts an object from the given to the desired type. -
getReturnType
Description copied from interface:Expression
Gets the return type of this expression.- Returns:
- A supertype of any objects returned by
Expression.getSingle(Event)
and the component type of any arrays returned byExpression.getArray(Event)
-
getConvertedExpr
Description copied from class:SimpleExpression
Converts this expression to another type. Unless the expression is special, the default implementation is sufficient.This method is never called with a supertype of the return type of this expression, or the return type itself.
- Overrides:
getConvertedExpr
in classSimpleExpression<Object>
- Parameters:
to
- The desired return type of the returned expression- Returns:
- Expression with the desired return type or null if it can't be converted to the given type
- See Also:
Expression.getConvertedExpression(Class...)
,ConvertedExpression.newInstance(Expression, Class...)
,Converter
-