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.

@FunctionalInterface public interface DataSupplier<D>
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 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 with
      expressions - Any expressions that are used in the pattern
      parseResult - 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 event
      expressions - Expected to contain a single ItemType expression
      parseResult - 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 event
      expressions - Expected to contain a single Direction expression
      parseResult - 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 event
      expressions - Expected to contain a single Direction expression
      parseResult - 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 event
      expressions - Expected to contain a single ItemType or BlockData expression
      parseResult - 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 event
      expressions - Expected to contain a single Color expression
      parseResult - 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 event
      expressions - Expected to contain a single Number expression, may be nullable
      parseResult - 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 event
      expressions - Expected to contain a single Number expression, may be nullable
      parseResult - the parse result (unused)
      Returns:
      the number, or 1 if not present or invalid