Advanced
Best practices
Recommendations to integrate sofyCore safely and efficiently, from service lookup to error handling and performance.
- Handle
Optional.empty(). Any module may be disabled or reloading. - Never block the server thread with
join()orget()on a sofyCore future. - Fence late results with
OnlineUsers.sessionId(uuid)before applying them to a player. - Respect the hierarchy. Build actors from the real player; reserve console actors for decisions your plugin makes on its own.
- Do not retry uncertain writes blindly. A failed future after commit can still mean the write happened; read and reconcile.
- Keep placeholder resolvers and context providers free of I/O.
- Close your subscriptions (
AutoCloseable) inonDisable. - Use your own namespaces in
PersistenceServiceand 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.