Developer API Overview
AstralSync exposes a public API that allows other plugins to:
Read and write player snapshot data via
SyncAPIRegister custom
SnapshotAdapterimplementations to include plugin-specific data in snapshotsReact to data lifecycle events (
PlayerDataLoadedEvent,SnapshotCreatedEvent)
Package
All public API types live under:
Key packages:
Package | Contents |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Entry Points
Static API
SyncAPI is the primary entry point. All methods are static utility methods.
Adapter Registry
AdapterContainer.INSTANCE provides direct access to the adapter registry, including version-aware lookups.
Events
Listen to Bukkit events on the plugin's event bus:
Thread Safety
All database operations return
CompletableFuture— they execute on a virtual thread pool.adapter.apply(player, data)is always scheduled on the main server thread.DataHolderimplementations useConcurrentHashMapinternally.Do not call
SyncAPI.findData()orDataHolder.findByKey()from a thread that may race with the load/save cycle without external synchronization. In practice, afterPlayerDataLoadedEventfires, data is safe to read from the main thread.
Compatibility
AstralSync depends on:
AstralCore for
BinaryMessage, database utilities, and packet handlingPaper 1.21+ API
PacketEvents for distributed lock packet handling
Your plugin must declare AstralSync in its depend or softdepend list in plugin.yml to ensure correct load order.