Advanced
Threading and lifecycle
Which thread each sofyCore API call runs on, how futures complete and how to survive module reloads and shutdown.
Futures
- All
…Asyncmethods returnCompletableFutureand do their I/O on bounded workers. - Futures do not move continuations to the Bukkit thread. Use
Bukkit.getScheduler().runTask(plugin, …)before touching Bukkit. - Argument validation may throw directly before the work is queued; saturation and I/O failures complete the future exceptionally (for example
RejectedExecutionException). - Synchronous variants of storage methods block the caller while I/O runs on workers.
Memory reads
Methods documented as memory reads (online, vanished, frozen, cachedBalance, maySpeak, placeholders) never do I/O and are safe on the server thread.
Lifecycle
- Modules can be reloaded individually. Their service is unregistered and registered again, so look services up when you need them.
- On a normal shutdown, accepted work is drained before storage closes. A forced kill cannot save work that was only in memory.
- Late-enabled modules should enumerate
OnlineUsers.readySessions()instead of waiting for a join.