Skip to content

About

The public developer API for Histoblock, a Spigot, Paper and Folia plugin that keeps the history of blocks, mobs, players, items, portals and worlds.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

62 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Histoblock: Developer API

The public developer API for Histoblock, a Spigot, Paper and Folia plugin that keeps the history of blocks, mobs, players, items, portals and worlds.

This repository holds the API artifact, the documentation and compilable examples. The plugin itself is closed source; everything you need to build against it is here.

HistoblockProvider.find().ifPresent(api ->
        api.block(Position.of(block.getLocation())).thenAccept(view -> {
            HistoryRecord placed = view.placement();
            getLogger().info(placed == null ? "natural" : "placed by " + placed.actor().name());
        }));

What the API gives you

Records every recorded action, filtered by category, action, subject, actor, world, area and time, newest or oldest first
Views everything about one block, mob, player, item or portal in one call: who placed it, who hurt it, where it came from, who lit it
Live lookups an item's hidden id, where a stack came from, the placed mark of a block, the portal a block belongs to, a player's time per world, and since 1.1.0 who gets a kill, a living mob's combat ledger and placed blocks removed lately
Events HistoryRecordedEvent for every record, plus one typed event per category
Telling Histoblock (since 1.2.0) that your plugin rebuilt an area itself, so its placed marks stay right, and how fast Histoblock should save while your server is busy
Restores and snapshots (since 1.3.0) put an area back as it was, blocks and chest contents, and read what a chest or a player held at any moment

Everything lives under me.jaymar921.histoblock.api. Nothing in it names a class outside it apart from Bukkit and the JDK, and it ships as its own thin jar, the same for the Free and Pro editions.

The API never changes the world and never deletes history. Apart from two calls it only reads: blocksRestored records that your plugin put blocks back, and setSaveSpeed changes how often Histoblock saves until the next reload, which the server owner can forbid.

Start here

  1. Getting started: add the dependency, resolve the API, first lookup.
  2. Core concepts: records, subjects and keys, telling Histoblock, save speed, retention, threading, editions.
  3. API reference: every method and every view.
  4. Events: the general event and the six typed ones.
  5. Records reference: every action and the details it carries.
  6. Best practices: the rules that keep your plugin fast and correct.

Examples

Ten compilable plugins in examples/, smallest first:

Example Shows
QuickStartPlugin resolving the API, the version check, one typed listener
WhoPlacedPlugin /whoplaced: the placed mark and the block view
ProvenancePlugin /provenance: item ids, stack ledgers, origin chains
DeathReportPlugin a report on every player death from the combat summary
PortalLogPlugin /portalinfo and a live trip counter
PlayerHistoryPlugin /history: a view, a timeline query, time per world
KillCreditPlugin crediting kills vanilla gives to nobody, inside the death event
PlaceCounterPlugin a place and mine quest that cannot be farmed
ArenaResetPlugin an arena reset that tells Histoblock with blocksRestored
CrowdSaverPlugin slowing Histoblock's saving down while the server is crowded
GriefUndoPlugin /undogrief <player> <minutes>: undo what one player changed around you with restore
ChestWitnessPlugin what the chest you look at held an hour ago, from container

See examples/README.md for how to build them.

Downloads

Plugin apiVersion() Artifact
1.3.0 5 Histoblock-api.jar
1.2.0 4 Histoblock-api.jar
1.1.0 3 Histoblock-api.jar
1.0.0 2 Histoblock-api.jar
0.7.0 2 Histoblock-api.jar

apiVersion() goes up when a method, view or event is added. Code written for an older number keeps working on a newer plugin. See Versioning.

Requirements

Java 16 or newer
Server Spigot, Paper or Folia, 1.16.5 or newer
Runtime Histoblock 0.7.0 or newer installed on the server; 1.1.0 or newer for API 3, 1.2.0 or newer for API 4, 1.3.0 or newer for API 5

License

The API jar, documentation and examples are MIT. The Histoblock plugin is not.

About

The public developer API for Histoblock, a Spigot, Paper and Folia plugin that keeps the history of blocks, mobs, players, items, portals and worlds.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors