Mods
Resource Packs
Data Packs
Modpacks
Shaders
Plugins
Mods Resource Packs Data Packs Plugins Shaders Modpacks
Get Modrinth App Upgrade to Modrinth+
Sign in
ModsPluginsData PacksShadersResource PacksModpacks
Sign in
Settings
inject

inject

A library for making injecting into Netty easier!

414
0
Library
Technology
AboutChangelogVersions

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.andante.dev/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.

90% of ad revenue goes to creators

Support creators and Modrinth ad-free with Modrinth+

Compatibility

Minecraft: Java Edition

1.21.x

Platforms

Fabric
Folia
Paper
Purpur
Spigot

Supported environments

Server-side

Links

Report issues View source Join Discord server
Donate on Patreon

Creators

MC Brawls
MC BrawlsOrganization

Details

Licensed MIT
Published 6 months ago
Updated last week

Modrinth is open source.

main@a0bd011

© Rinth, Inc.

Company

TermsPrivacyRulesCareers

Resources

SupportBlogDocsStatus

Interact

Discord X (Twitter) Mastodon Crowdin
Get Modrinth App Settings
NOT AN OFFICIAL MINECRAFT SERVICE. NOT APPROVED BY OR ASSOCIATED WITH MOJANG OR MICROSOFT.