Interface DataSupplier<D>
- Type Parameters:
D- the data type to supply
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A functional interface for supplying data to effects from parsed expressions.
Effectively an
Expression in disguise. Accepts the parsed context of expressions and parse result,
spits out the required data value.-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable org.bukkit.block.data.BlockDatagetBlockData(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets block data from an ItemType or BlockData expression.static @Nullable org.bukkit.block.BlockFacegetBlockFaceData(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets block face data from a Direction expression.static @Nullable org.bukkit.block.BlockFacegetCartesianBlockFaceData(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets cartesian block face data from a Direction expression.static @Nullable org.bukkit.ColorgetColorData(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets color data from a skript Color expression.getData(@Nullable org.bukkit.event.Event event, Expression<?>[] expressions, SkriptParser.ParseResult parseResult) Supplies data from the parsed expressions from a pattern.static @Nullable org.bukkit.MaterialgetMaterialData(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets material data from an ItemType expression.static intgetNumberDefault1(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets a number from the first expression, defaulting to 1 if not present or invalid.static intgetNumberDefault10(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets a number from the first expression, defaulting to 10 if not present or invalid.static booleanisOminous(org.bukkit.event.Event event, Expression<?>[] expressions, @NotNull SkriptParser.ParseResult parseResult) Checks if the "ominous" tag was present in the parse result.
-
Method Details
-
getData
@Nullable D getData(@Nullable @Nullable org.bukkit.event.Event event, Expression<?>[] expressions, SkriptParser.ParseResult parseResult) Supplies data from the parsed expressions from a pattern.- Parameters:
event- The event to evaluate withexpressions- Any expressions that are used in the patternparseResult- The parse result from parsing- Returns:
- The data to use for the effect, or null if the required data could not be obtained
-
getMaterialData
@Nullable static @Nullable org.bukkit.Material getMaterialData(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets material data from an ItemType expression.- Parameters:
event- the eventexpressions- Expected to contain a single ItemType expressionparseResult- the parse result (unused)- Returns:
- the material, or null if the input was not an ItemType
-
getBlockFaceData
@Nullable static @Nullable org.bukkit.block.BlockFace getBlockFaceData(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets block face data from a Direction expression.- Parameters:
event- the eventexpressions- Expected to contain a single Direction expressionparseResult- the parse result (unused)- Returns:
- the block face, or null if the input was not a Direction
-
getCartesianBlockFaceData
@Nullable static @Nullable org.bukkit.block.BlockFace getCartesianBlockFaceData(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets cartesian block face data from a Direction expression. The white smoke effect only allows the six cardinal directions, so this function maps any direction to the nearest of those.- Parameters:
event- the eventexpressions- Expected to contain a single Direction expressionparseResult- the parse result (unused)- Returns:
- the cartesian block face, or null if the input was not a Direction
-
getBlockData
@Nullable static @Nullable org.bukkit.block.data.BlockData getBlockData(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets block data from an ItemType or BlockData expression.- Parameters:
event- the eventexpressions- Expected to contain a single ItemType or BlockData expressionparseResult- the parse result (unused)- Returns:
- the block data, or null if the input was not an ItemType or BlockData
-
getColorData
@Nullable static @Nullable org.bukkit.Color getColorData(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets color data from a skript Color expression.- Parameters:
event- the eventexpressions- Expected to contain a single Color expressionparseResult- the parse result (unused)- Returns:
- the color, or null if the input was not a Color
-
isOminous
static boolean isOminous(org.bukkit.event.Event event, Expression<?>[] expressions, @NotNull @NotNull SkriptParser.ParseResult parseResult) Checks if the "ominous" tag was present in the parse result.- Parameters:
event- the event (unused)expressions- the expressions (unused)parseResult- the parse result- Returns:
- true if the "ominous" tag was present, false otherwise
-
getNumberDefault10
static int getNumberDefault10(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets a number from the first expression, defaulting to 10 if not present or invalid.- Parameters:
event- the eventexpressions- Expected to contain a single Number expression, may be nullableparseResult- the parse result (unused)- Returns:
- the number, or 10 if not present or invalid
-
getNumberDefault1
static int getNumberDefault1(org.bukkit.event.Event event, Expression<?> @NotNull [] expressions, SkriptParser.ParseResult parseResult) Gets a number from the first expression, defaulting to 1 if not present or invalid.- Parameters:
event- the eventexpressions- Expected to contain a single Number expression, may be nullableparseResult- the parse result (unused)- Returns:
- the number, or 1 if not present or invalid
-