Interface SpecialBlock

All Superinterfaces:
Metadatable, PersistentStorage.Holder
All Known Subinterfaces:
CustomBlock, JoinArenaSignBlock, RankingSignBlock, RankingSkullBlock

public interface SpecialBlock extends Metadatable, PersistentStorage.Holder
A SpecialBlock represents a normal block with special (maybe even interactable) features.

They get automatically saved and loaded and it's possible to create custom variants using CustomBlock

  • Method Summary

    Modifier and Type
    Method
    Description
    Returns Bukkit's variant of the block that's located at the same location as this one
    void
    Returns Bukkit's variant of the block that's located at the same location as this one.
    boolean
    Returns if this block is still existing inside its WorldStorage.
    Keep in mind that this varies per instance and that this instance is forever garbage when it returns false
    SpecialBlocks vary from the type they represent.
    Returns the world to which this block initially was added.
    Keep in mind that the block might have been removed.
    int
    Returns the x coordinate of this block
    short
    Returns the y coordinate of this block
    int
    Returns the z coordinate of this block
    void
    onInteract(Player player, PlayerInteractEvent parentEvent)
    Call this if you want to simulate an interaction of the player
    boolean
    Tries to remove this block from its WorldStorage
    void
    Tries to apply the given informations into the game world.
    By this e.g. a sign gets updated with the newly changed stats

    Methods inherited from interface org.bukkit.metadata.Metadatable

    getMetadata, hasMetadata, removeMetadata, setMetadata

    Methods inherited from interface de.marcely.bedwars.tools.PersistentStorage.Holder

    getPersistentStorage
  • Method Details

    • getType

      BlockType getType()
      SpecialBlocks vary from the type they represent. You may cast to the corresponding type after matching its type
      Returns:
      The type of this SpecialBlock
    • getWorld

      WorldStorage getWorld()
      Returns the world to which this block initially was added.
      Keep in mind that the block might have been removed. You can verify it by calling exists()
      Returns:
      The world to which this block was added to
    • asBukkit

      Block asBukkit()
      Returns Bukkit's variant of the block that's located at the same location as this one
      Returns:
      The Block located at the same location as this one
    • asBukkitAsync

      void asBukkitAsync(Consumer<Block> callback)
      Returns Bukkit's variant of the block that's located at the same location as this one.

      If supported, it will uses paper's async chunk loading feature.

      Parameters:
      callback - The callback that is being called on the main thread
    • getX

      int getX()
      Returns the x coordinate of this block
      Returns:
      The x coordinate
    • getY

      short getY()
      Returns the y coordinate of this block
      Returns:
      The y coordinate
    • getZ

      int getZ()
      Returns the z coordinate of this block
      Returns:
      The z coordinate
    • update

      void update()
      Tries to apply the given informations into the game world.
      By this e.g. a sign gets updated with the newly changed stats
    • onInteract

      void onInteract(Player player, PlayerInteractEvent parentEvent)
      Call this if you want to simulate an interaction of the player
      Parameters:
      player - The player who clicked on the sign
      parentEvent - The event which might contain info needed for the block
    • exists

      boolean exists()
      Returns if this block is still existing inside its WorldStorage.
      Keep in mind that this varies per instance and that this instance is forever garbage when it returns false
      Returns:
      If this block still exists
    • remove

      boolean remove()
      Tries to remove this block from its WorldStorage
      Returns:
      false when it already has been removed. Otherwise true