Skip to content

Advanced

Best practices

Recommendations to integrate sofyCore safely and efficiently, from service lookup to error handling and performance.

  1. Handle Optional.empty(). Any module may be disabled or reloading.
  2. Never block the server thread with join() or get() on a sofyCore future.
  3. Fence late results with OnlineUsers.sessionId(uuid) before applying them to a player.
  4. Respect the hierarchy. Build actors from the real player; reserve console actors for decisions your plugin makes on its own.
  5. Do not retry uncertain writes blindly. A failed future after commit can still mean the write happened; read and reconcile.
  6. Keep placeholder resolvers and context providers free of I/O.
  7. Close your subscriptions (AutoCloseable) in onDisable.
  8. Use your own namespaces in PersistenceService and never edit sofyCore namespaces directly.

Limitations

  • No multi-record transactions in PersistenceService.
  • Pub/sub messages are transient and may be lost during disconnections.
  • PlaceholderAPI only exposes sofyCore's own keys, not keys registered by other plugins.