Class DataBlock

java.lang.Object
redempt.redlib.blockdata.DataBlock

public class DataBlock extends Object
Represents a Block with data attached to it
  • Field Details

  • Method Details

    • getManager

      public BlockDataManager getManager()
      Returns:
      The BlockDataManager this DataBlock belongs to
    • getTransientProperties

      public Map<String,Object> getTransientProperties()
      Returns:
      A map which can be used to store properties that do not persist
    • getBlock

      public org.bukkit.block.Block getBlock()
      Returns:
      The Block the data is attached to
    • getChunkPosition

      protected ChunkPosition getChunkPosition()
    • getBlockPosition

      protected redempt.redlib.blockdata.BlockPosition getBlockPosition()
    • getObject

      public Object getObject(String key)
      Gets an object by key
      Parameters:
      key - The key the data is mapped to
      Returns:
      The data as an Object
    • getString

      public String getString(String key)
      Gets a string by key
      Parameters:
      key - The key the data is mapped to
      Returns:
      The data as a String
    • getInt

      public Integer getInt(String key)
      Gets an int by key
      Parameters:
      key - The key the data is mapped to
      Returns:
      The data as an Integer
    • getLong

      public Long getLong(String key)
      Gets a long by key
      Parameters:
      key - The key the data is mapped to
      Returns:
      The data as a Long
    • getDouble

      public Double getDouble(String key)
      Gets a Double by key
      Parameters:
      key - The key the data is mapped to
      Returns:
      The data as a Double
    • getBoolean

      public Boolean getBoolean(String key)
      Gets a Boolean by key
      Parameters:
      key - The key the data is mapped to
      Returns:
      The data as a Boolean
    • getList

      public JSONList getList(String key)
      Gets a JSONList by key
      Parameters:
      key - The key the data is mapped to
      Returns:
      The data as a JSONList
    • getMap

      public JSONMap getMap(String key)
      Gets a JSONMap by key
      Parameters:
      key - The key the data is mapped to
      Returns:
      The data as a JSONMap
    • contains

      public boolean contains(String key)
      Checks if a certain key is used in this DataBlock
      Parameters:
      key - The key
      Returns:
      Whether the key is used
    • clear

      public void clear()
      Clears all data from this DataBlock
    • set

      public void set(String key, Object value)
      Sets data in this DataBlock
      Parameters:
      key - The key to set the data with
      value - The data
    • remove

      public void remove(String key)
      Removes a key from this DataBlock
      Parameters:
      key - The key to remove
    • getData

      public Map<String,Object> getData()
      Returns:
      All data stored in this DataBlock
    • getKeys

      public Set<String> getKeys()
      Returns:
      All keys used in this DataBlock