CustomBlockData 2.1.0 API

CustomBlockData is a library for the Bukkit API to provide a PersistentDataContainer for every Block in the world.

It does not need any files or databases. All data is stored inside the chunk's PersistentDataContainer and is persistent after server restart. CustomBlockData can also automatically delete your custom data when a block gets broken, move your data if the block gets moved by pistons, etc. By default, however, and for backward compatibility reasons, data stored inside blocks is independent of the underlying block. That means: if you store some data inside a dirt block, and that block is now pushed by a piston, then the information will still reside in the old block's location, unless you have enabled this feature explicitly using CustomBlockData.registerListener(Plugin).

There are a few things you should keep in mind when using this library:

  • All data you add to a block gets saved into the Chunk's PersistentDataContainer, which in return is saved directly into your World's region files.
  • This library is not intended to store excessive amounts of data. With "excessive amounts", I am talking about tens or hundreds of Megabytes per Chunk.

Need more PersistentDataTypes?

If you feel limited by the existing PersistentDataTypes, take a look at my MorePersistentDataTypes library. It doesn't only add more than 40 new PersistentDataTypes, but also allows to you to store any kind of Collection, Map or Array inside the PersistentDataContainer. Of course it also supports nested Maps and Collections like for example Map<String<Map<Integer,ItemStack>>. You can find that library on GitHub and on SpigotMC.

Packages
Package
Description
The root package of the CustomBlockData API
Classes dedicated to handling triggered code executions