JNI Architecture
Zernyth embeds a JVM in the Bedrock server process. Endstone's plugin manager stays in charge.
How it fits together
JavaPluginLoader is registered next to the C++ and Python loaders and provides native plugin adapters. EndstonePluginManager keeps responsibility for name checks, dependencies, load order, lifecycle and cleanup. There is no second plugin manager, event dispatcher or scheduler.
Handles
Java objects hold opaque owner and object identifiers, never native pointers. The context is looked up before every native operation. Identifiers are not recycled.
Threads
Native gameplay access requires the server thread and a live plugin context, including reads. Violations throw IllegalStateException. Value objects and copied responses are safe on workers.
JVM lifetime
The JVM lives until the process ends. It is not destroyed when a plugin is disabled, because Java threads could block that indefinitely. The Invocation API uses JNI_VERSION_24, the highest revision defined by the JDK 25 headers.