Перейти к содержимому
Mineforgian

inject

A library for making injecting into Netty easier!

Загрузки
1K
Подписчики
2
Обновлён
17 июня 2026 г.
Лицензия
MIT

Опубликован 3 ноября 2024 г.

inject

Inject is a simple server-side library to allow developers to inject into Netty easier.

Example

This uses the HttpInjector class to respond to HTTP requests to the Minecraft server.

class MyEpicHttpInjector extends HttpInjector {
    @Override
    public HttpByteBuf intercept(ChannelHandlerContext ctx, HttpRequest request) {
        HttpByteBuf buf = HttpByteBuf.httpBuf(ctx);
        buf.writeStatusLine("1.1", 200, "OK");
        buf.writeText("Hello, from Minecraft!");
        return buf;
    }
}

Registration

For Fabric, use the InjectFabric class:

public class MyMod implements ModInitializer {
    @Override
    public void onInitialize() {
        InjectFabric.INSTANCE.registerInjector(new MyEpicHttpInjector());
    }
}

For Spigot, Paper and derivatives, use the InjectSpigot class:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        InjectSpigot.INSTANCE.registerInjector(new MyEpicHttpInjector());
    }
}

This will register an HTTP injector which will respond with Hello, from Minecraft! to any HTTP request to the Minecraft port.

$ curl http://localhost:25565
Hello, from Minecraft!

Supported web servers

  • Spring Boot: spring module
  • Javalin: javalin module
  • Ktor: ktor module
  • Jetty: jetty module
  • manual request handling: http module

Examples can be found in the examples module.

Usage

Add the andante repo to gradle:

repositories {
    maven("https://maven.mcbrawls.net/releases/")
}

Add the dependency:

dependencies {
    implementation("net.mcbrawls.inject:api:VERSION")
 
    // For HTTP-related things:
    implementation("net.mcbrawls.inject:http:VERSION")

    // Fabric:
    include(modImplementation("net.mcbrawls.inject:fabric:VERSION")!!)
 
    // Spigot/Paper:
    implementation("net.mcbrawls.inject:spigot:VERSION")

    // You can find the other modules for Spring, Ktor, etc. on the Github repo.
}

Replace VERSION with the latest version from the releases tab.

Ченджлог

3.1.3Релиз1.21.2, 1.21.3, 1.21.4 · 17 марта 2025 г.

fix(#3): handle OpaqueByteBufHolder correctly

3.1.1Релиз1.21.2, 1.21.3, 1.21.4 · 20 декабря 2024 г.
  • feat: velocity support
3.0.0Релиз1.21.2, 1.21.3, 1.21.4 · 12 декабря 2024 г.
  • Spring Boot support
  • Ktor support
  • Javalin support
  • Jetty support
  • Merge spigot and paper module into one
3.0.0Релиз1.21.2, 1.21.3, 1.21.4 · 12 декабря 2024 г.
  • Spring Boot support
  • Ktor support
  • Javalin support
  • Jetty support
  • Merge spigot and paper module into one
2.2.2Релиз1.21.1, 1.21.2, 1.21.3 · 11 ноября 2024 г.

Fixes #2

2.2.2Релиз1.21.1, 1.21.2, 1.21.3 · 11 ноября 2024 г.

Fixes #2

2.2.2Релиз1.21.1, 1.21.2, 1.21.3 · 11 ноября 2024 г.

Fixes #2

Комментарии

Загружаем…