Class BlockUtil

java.lang.Object
com.plotsquared.core.util.BlockUtil

public final class BlockUtil extends Object
BlockState related utility methods
  • Method Summary

    Modifier and Type
    Method
    Description
    static @Nullable com.sk89q.worldedit.world.block.BlockState
    deserialize​(@NonNull Map<String,​Object> map)
    Deserialize a serialized BlockState
    static @Nullable com.sk89q.worldedit.world.block.BlockState
    get​(int id)
    Get a BlockState from a legacy id
    static @Nullable com.sk89q.worldedit.world.block.BlockState
    get​(int id, int data)
    Get a BlockState from a legacy id-data pair
    static @Nullable com.sk89q.worldedit.world.block.BlockState
    get​(@NonNull String id)
    Get a BlockState from its ID
    static @NonNull com.sk89q.worldedit.world.block.BlockState[]
    parse​(@NonNull String commaDelimited)
    Parse a comma delimited list of block states

    Methods inherited from class java.lang.Object

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

    • get

      public static @Nullable com.sk89q.worldedit.world.block.BlockState get(int id)
      Get a BlockState from a legacy id
      Parameters:
      id - Legacy ID
      Returns:
      Block state, or null
    • get

      public static @Nullable com.sk89q.worldedit.world.block.BlockState get(int id, int data)
      Get a BlockState from a legacy id-data pair
      Parameters:
      id - Legacy ID
      data - Legacy data
      Returns:
      Block state, or null
    • get

      public static @Nullable com.sk89q.worldedit.world.block.BlockState get(@NonNull String id)
      Get a BlockState from its ID
      Parameters:
      id - String or integer ID
      Returns:
      Parsed block state, or null if none could be parsed
    • parse

      public static @NonNull com.sk89q.worldedit.world.block.BlockState[] parse(@NonNull String commaDelimited)
      Parse a comma delimited list of block states
      Parameters:
      commaDelimited - List of block states
      Returns:
      Parsed block states
    • deserialize

      public static @Nullable com.sk89q.worldedit.world.block.BlockState deserialize(@NonNull Map<String,​Object> map)
      Deserialize a serialized BlockState
      Parameters:
      map - Serialized block state
      Returns:
      Deserialized block state, or null if the map is not a properly serialized block state