TemporaryBlockManager

public final class TemporaryBlockManager implements Listener

Manages temporary block placements that automatically revert after a set duration. Blocks placed through this manager are tracked to prevent item drops on break and are restored to their original state when the timer expires.

Types

Link copied to clipboard
public final class OwnedBlock implements AutoCloseable
Optional conditional restoration, shared across shaded consumers through Bukkit metadata.

Functions

Link copied to clipboard
public static void addTemporaryBlock(Block block, int ticks, Material replacementMaterial)
Places a temporary block that reverts after the given number of ticks.
public static void addTemporaryBlock(Block block, int ticks, Material replacementMaterial, boolean requireAir)
Places a temporary block, optionally only if the target block is air.
Link copied to clipboard
public static boolean canOwn(Block block)
Preflight without loading chunks.
Link copied to clipboard
public static void initialize(JavaPlugin plugin)
Registers the block break and world unload listeners.
Link copied to clipboard
public static boolean isTemporaryBlock(Block block)
Link copied to clipboard
public void onBlockBreak(BlockBreakEvent event)
Link copied to clipboard
public void onBlockPlace(BlockPlaceEvent event)
Link copied to clipboard
public void onChunkUnload(ChunkUnloadEvent event)
Link copied to clipboard
public void onWorldUnload(WorldUnloadEvent event)
Link copied to clipboard
public static void removeTemporaryBlock(Block block)
Link copied to clipboard
public static TemporaryBlockManager.OwnedBlock replaceOwned(Block block, BlockData replacement, Plugin owner)
Link copied to clipboard
public static void shutdown()
Restores still-owned temporary blocks and clears tracking.