Skip to content
whereareiamPublic

About

Extension framework for JVM hosts: discovery, isolated loading, lifecycle and services for plugins' modules

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chassis

Chassis loads extensions into JVM hosts such as Minecraft plugins and mods. A host names its kind of extension, the folder their jars lie in and the descriptor each jar carries; Chassis finds the jars, resolves their dependencies, loads each in a class loader of its own that sees only what the host exports, starts and stops them in order, and removes everything an extension registered when it stops.

A first host

The host declares its kind of extension and starts a ChassisHost:

public interface ExampleModule extends Extension<ExtensionContext> {
}
HostOptions options = HostOptions.builder()
        .kind("module")
        .folder(dataFolder.resolve("modules"))
        .descriptorFile("example-module.yml")
        .dataFolder(dataFolder.resolve("module-data"))
        .selectionFile(dataFolder.resolve("modules.yml"))
        .hostVersion(Version.parse("1.0.0"))
        .platform(new NeoForgePlatform())
        .exportLayer(new ExportLayer(ExampleHost.class.getClassLoader(),
                List.of("me.whereareiam.chassis", "com.example.host.api")))
        .build();

ChassisHost<ExtensionContext, Void> modules = new ChassisHost<>(options, ExampleModule.class, base -> base, ExtensionFactory.CONSTRUCTOR);
modules.start();

An extension is a jar in modules/ with a descriptor and a main class of that kind:

id: greeting
version: 1.0.0
main: com.example.greeting.GreetingModule
public final class GreetingModule implements ExampleModule {
    @Override
    public void enable(@NotNull ExtensionContext context) {
        context.logger().log(System.Logger.Level.INFO, "Hello from " + context.descriptor().getName());
    }
}

Dependency

Chassis is published to https://registry.whereareiam.me/maven/packages and needs Java 21:

repositories {
    maven("https://registry.whereareiam.me/maven/packages")
}

dependencies {
    implementation("me.whereareiam.chassis:chassis-common:0.1.0")
}

Documentation

The guides for hosts and contributors are in docs/content/; start with Getting started.

License

Chassis is available under the MIT License.

About

Extension framework for JVM hosts: discovery, isolated loading, lifecycle and services for plugins' modules

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages