Interface VirtualBlockManager


public interface VirtualBlockManager
Manages virtual (client-side only) blocks for a specific player.

Unlike standard fake blocks, blocks managed here are "persistent" at the network layer. Pulse tracks these blocks and will automatically re-send them to the client if the server performs a full chunk refresh (e.g., during explosions or lighting updates).

  • Method Details

    • setBlock

      void setBlock(@NotNull @NotNull Location location, @NotNull @NotNull BlockData data)
      Sets a persistent virtual block at the specified location.

      This block is stored in the Pulse session and will be restored automatically if the underlying chunk is re-sent to the player.

      Parameters:
      location - the coordinates where the block should appear
      data - the block state data to be displayed
    • removeBlock

      void removeBlock(@NotNull @NotNull Location location)
      Removes a virtual block and restores the actual server-side state.

      Pulse will stop tracking this location and send a packet to the client with the real block data currently existing on the server.

      Parameters:
      location - the coordinates to restore
    • getBlock

      Retrieves the data of a virtual block if it is currently tracked.
      Parameters:
      location - the coordinates to check
      Returns:
      the BlockData of the virtual block, or null if the player sees the real world state
    • clearAll

      void clearAll()
      Clears all virtual blocks tracked for this player.

      Note: This does not automatically refresh the client's view. The player will see real blocks only after a chunk reload or manual update.

    • beginContext

      void beginContext()
      Enables manual virtual context mode.

      While active, all block update packets sent to the player (via any plugin or NMS) are automatically intercepted and registered as persistent virtual blocks. Use this for sending large schematics or client-side only structures.

    • endContext

      void endContext()
      Disables manual virtual context mode and returns to normal network behavior.