Paper Plugin Guide
File mode0

Paper essentials

Saving data on things: PersistentDataContainer

Attach your own data to items, entities, blocks and chunks, and it survives restarts.

Intermediate1 min read

This page is still being written.

What it will cover

  • Mental model: sticky notes with your plugin name on them (diagram)
  • NamespacedKey(plugin, name) and key naming rules
  • PersistentDataType: STRING, INTEGER, DOUBLE, BOOLEAN, LONG, BYTE, LIST.strings(), TAG_CONTAINER; custom types briefly
  • Items: editPersistentDataContainer / getPersistentDataContainer and has/get/set/remove
  • Entities and players, chunks, worlds, tile entity blocks (TileState) with update()
  • Tagging custom items reliably vs checking names
  • Limits: what PDC is not for (huge data)
  • Example plugin: soulbound items and per-player kill counter stored in PDC (plugins/pdc-demo)