Class BlockUtils

java.lang.Object
ch.njol.skript.util.BlockUtils

public class BlockUtils extends Object
TODO !Update with every version [blocks] - also update aliases-*.sk
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable String
    blockToString(org.bukkit.block.Block block, int flags)
    Get the string version of a block, including type and location.
    static @Nullable org.bukkit.block.data.BlockData
    createBlockData(String dataString)
     
    static org.bukkit.block.Block
    extractBlock(org.bukkit.block.Block block)
    Extracts the actual CraftBukkit block from the given argument, by extracting the block from DelayedChangeBlock if the given argument is a DelayedChangeBlock.
    static Iterable<org.bukkit.block.Block>
    getBlocksAround(org.bukkit.block.Block b)
     
    static Iterable<org.bukkit.block.BlockFace>
     
    static @Nullable org.bukkit.Location
    getLocation(@Nullable org.bukkit.block.Block b)
     
    static void
    sendBlockChange(org.bukkit.entity.Player player, org.bukkit.Location location, org.bukkit.Material type, @Nullable BlockValues blockValues)
     
    static boolean
    set(org.bukkit.block.Block block, ItemData type, boolean applyPhysics)
     
    static boolean
    set(org.bukkit.block.Block block, org.bukkit.Material type, @Nullable BlockValues blockValues, boolean applyPhysics)
    Sets the given block.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BlockUtils

      public BlockUtils()
  • Method Details

    • set

      public static boolean set(org.bukkit.block.Block block, org.bukkit.Material type, @Nullable @Nullable BlockValues blockValues, boolean applyPhysics)
      Sets the given block.
      Parameters:
      block - Block to set.
      type - New type of the block.
      blockValues - Block values to apply after setting the type.
      applyPhysics - Whether physics should be applied or not.
      Returns:
      Whether setting block succeeded or not (currently always true).
    • set

      public static boolean set(org.bukkit.block.Block block, ItemData type, boolean applyPhysics)
    • sendBlockChange

      public static void sendBlockChange(org.bukkit.entity.Player player, org.bukkit.Location location, org.bukkit.Material type, @Nullable @Nullable BlockValues blockValues)
    • getBlocksAround

      public static Iterable<org.bukkit.block.Block> getBlocksAround(org.bukkit.block.Block b)
    • getFaces

      public static Iterable<org.bukkit.block.BlockFace> getFaces()
    • getLocation

      @Nullable public static @Nullable org.bukkit.Location getLocation(@Nullable @Nullable org.bukkit.block.Block b)
      Parameters:
      b - A block
      Returns:
      Location of the block, including its direction
    • createBlockData

      @Nullable public static @Nullable org.bukkit.block.data.BlockData createBlockData(String dataString)
    • blockToString

      @Nullable public static @Nullable String blockToString(org.bukkit.block.Block block, int flags)
      Get the string version of a block, including type and location. ex: 'stone' at 1.5, 1.5, 1.5 in world 'world' World can be null if the Block is Skript's BlockStateBlock.
      Parameters:
      block - Block to get string of
      flags -
      Returns:
      String version of block
    • extractBlock

      public static org.bukkit.block.Block extractBlock(org.bukkit.block.Block block)
      Extracts the actual CraftBukkit block from the given argument, by extracting the block from DelayedChangeBlock if the given argument is a DelayedChangeBlock.
      Returns:
      the actual CB block from the given argument