Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 2.47 KB

File metadata and controls

51 lines (34 loc) · 2.47 KB

Shared development virions

A shared virion is trusted local development code registered once on PocketMine's shared ThreadSafeClassLoader. Multiple folder plugins can use its classes without embedding duplicate copies during development. DevTools never downloads virions.

Package layout

virions/ExampleVirion/
├── virion.yml
├── src/Example/Virion/ClassName.php
├── resources/              optional
└── LICENSE                 recommended

Source folders are preferred; local .phar virions are also accepted. Symlinks are rejected.

name: ExampleVirion
version: 1.2.3
antigen: Example\Virion
api: 5.0.0
# php: 8.1               optional alternative/additional compatibility

name, semantic version, antigen, and at least one of api or php are required. Every declared class must remain below the antigen and match its path/casing.

Plugin declaration and selection

Declare requirements in the plugin's devtools.yml:

virions:
  - name: ExampleVirion
    version: ">=1.2.0 <2.0.0"

At startup, DevTools gathers folder-plugin requirements, filters packages incompatible with the current PHP/API, then loads the highest semantic version satisfying all declarations. Lower or incompatible versions are recorded as SKIPPED. If no version satisfies every plugin, no copy of that virion is loaded and every candidate is recorded as CONFLICT. Two copies of the selected version are ambiguous and rejected instead of choosing by path order.

The same resolver is used during standalone builds. A missing package or version mismatch fails the build before an artifact is written.

Debugging

Run /devtools virions. Every discovered package is shown as LOADED, SKIPPED, FAILED, or CONFLICT, with version/location/reason. /devtools status reports the loaded count and async-worker class-loader state.

Registration is visible to existing and future async workers because PocketMine shares the loader object. This exposes code only; plugin objects and mutable main-thread state are not transferred to workers.

Namespace and class conflicts

DevTools rejects overlapping antigens, duplicate classes, classes outside an antigen, non-autoloadable casing, duplicate selected versions, invalid packages, and incompatible versions before registration. PHP cannot unload a registered class, so change virion code/version and restart the process rather than attempting hot reload.

See the tested end-to-end example.