--- title: "Events API - BuildPrint wiki" description: "Hear what easy place, the printer, easy break and the excavator do, and when a build is finished." url: https://voxelsprout.com/buildprint/wiki/events-api --- [BuildPrint](https://voxelsprout.com/buildprint) [Wiki](https://voxelsprout.com/buildprint/wiki)Events API # Events API Hear what easy place, the printer, easy break and the excavator do, and when a build is finished. For a quest mod (a quest done when a build is), a stats mod, or a HUD of your own. From BuildPrint **0.1.41**. ```java BuildprintEvents.listen("mymod", e -> { switch ((String) e.get("type")) { case "finished" -> MyQuests.buildDone((String) e.get("name")); case "placed" -> MyStats.count((String) e.get("by")); default -> { } // later versions may add types } }); // No longer needed. BuildprintEvents.unlisten("mymod"); ``` ## Events Every event is a read-only map with a `type`. Later versions may add types and keys but never take one away, so ignore what you do not know. | type | When | Keys | | -------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | placed | Easy place or the printer put a block down and the server took the click. | by (easy\_place or printer), dimension, pos (int\[\]{x, y, z}), block (the block state), build (the build there, or -1) | | broken | Easy break or the excavator broke a block. | The same, with by easy\_break or excavator, and block what was there. | | progress | A build's counts changed. Looked at about once a second. | build, completion (0 to 1), counts (as [counts](https://voxelsprout.com/buildprint/wiki/placements-api)) | | finished | Every block of a build is right, after it was not. Once each time. | build, name | ## Good to know * Your listener is called on the client thread at the end of the tick the event happened in. * Blocks the player places or breaks by hand are not events here. The game has its own events for those. * A build that was already finished when it loaded does not send `finished`. * One listener per owner: a second call replaces the first. When it throws, BuildPrint logs it once and stops telling you until you listen again. * Only plain Java types, so you can call it [by reflection](https://voxelsprout.com/buildprint/wiki/blueprints-api#without-a-compile-dependency). ## Reference | BuildprintEvents | What it does | | ------------------------------------------------------------ | --------------------------------------- | | listen(String owner, Consumer> listener) | Hear every event. | | unlisten(String owner) | Stop telling that owner. | | isAvailable() | In a world. Listening works either way. | [Previous Rules API](https://voxelsprout.com/buildprint/wiki/rules-api) [Next Protection API](https://voxelsprout.com/buildprint/wiki/protection-api) Something missing or wrong on this page? Say so on [Discord](https://discord.gg/CvdkGbEW4y).