Pages: Velocity

Velocity

Extend SporeVelocityPlugin and pass the injected values through:

@Plugin(id = "atlas", name = "Atlas", version = "1.0")
class AtlasVelocity @Inject constructor(
    server: ProxyServer,
    logger: Logger,
    @DataDirectory dataDirectory: Path
) : SporeVelocityPlugin(server, logger, dataDirectory) {

    override fun onPluginEnable() {
        SporeDebugCommand.register(commandManager, "atlasv", "atlas.admin")
    }

    override fun setupCloud(manager: SporeVelocityCommandManager) {
        // suggestion providers, parsers...
    }
}

On proxy start SporeAPI sets itself up and registers every @RegisterCommand class (Cloud annotations) and every @RegisterListener class (any class with @Subscribe methods). Command methods can take a Player directly. On proxy shutdown everything is cleaned up, including running coroutines.

SporeVelocity.server / SporeVelocity.plugin give you the proxy from anywhere, and CommandSource.success() / error() work like on Paper. Everything from common (coroutines, repeat, event bus, timings, rate limiter, incidents) works the same on the proxy.