Class BlockLineIterator

java.lang.Object
ch.njol.skript.util.BlockLineIterator
All Implemented Interfaces:
Iterator<org.bukkit.block.Block>

public class BlockLineIterator extends Object implements Iterator<org.bukkit.block.Block>
Iterates through blocks in a straight line from a start to end location (inclusive).

Given start and end locations are always cloned but may not be block-centered. Iterates through all blocks the line passes through in order from start to end location.

  • Constructor Details

    • BlockLineIterator

      public BlockLineIterator(@NotNull @NotNull org.bukkit.Location start, @NotNull @NotNull org.bukkit.Location end)
      Parameters:
      start - start location
      end - end location
    • BlockLineIterator

      public BlockLineIterator(@NotNull @NotNull org.bukkit.block.Block start, @NotNull @NotNull org.bukkit.block.Block end)
      Parameters:
      start - first block
      end - last block
    • BlockLineIterator

      public BlockLineIterator(org.bukkit.Location start, @NotNull @NotNull org.bukkit.util.Vector direction, double distance)
      Parameters:
      start - start location
      direction - direction to travel in
      distance - maximum distance to travel
    • BlockLineIterator

      public BlockLineIterator(@NotNull @NotNull org.bukkit.block.Block start, org.bukkit.util.Vector direction, double distance)
      Parameters:
      start - first block
      direction - direction to travel in
      distance - maximum distance to travel
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<org.bukkit.block.Block>
    • next

      public org.bukkit.block.Block next()
      Specified by:
      next in interface Iterator<org.bukkit.block.Block>