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

Fabric Plugin Messaging

A standard library to send and receive plugin messages on a proxied network

49
0
Library
AboutChangelogVersions

Fabric Plugin Messaging

Enviroment Server Discord

A Fabric plugin messaging library! This server-sided mod will register a Plugin Message Packet (PluginMessagePacket.class) and a Plugin Message Event (PluginMessageEvent#EVENT) for developers to use in their projects.

Without this mod, developers would need to register their own packets, which would cause conflicts if multiple are present at the same time. By using the Packet and Listener provided here, this issue is avoided.

Developer Info

Add the mod as a dependency in your gradle build script! This will include the API in your final build.

dependencies {
    modImplementation(include("com.pokeskies:fabricpluginmessage:1.0.0"))
}

Sending

Then you can send Plugin Messages by creating an instance of the PluginMessagePacket class and then sending it! You can either create it by passing a byte array or a FriendlyByteBuf:

ByteArrayDataOutput outputStream = ByteStreams.newDataOutput();
outputStream.writeUTF("Connect");
outputStream.writeUTF("cobblemon");

ServerPlayNetworking.send(player, new PluginMessagePacket(outputStream.toByteArray()));

Receiving

If you need to receive a Plugin Message from the proxy, you can subscribe to the PluginMessageEvent:

PluginMessageEvent.EVENT.register((payload, context) -> {
    ByteArrayDataInput inputStream  = ByteStreams.newDataInput(payload.getData());
    String channel = inputStream.readUTF();
    if (channel.equals("GetServers")) {
        String serversList = inputStream.readUTF();
        System.out.println("Proxy Servers: " + serversList);
    }
});

Support

A community support Discord has been opened up for all Skies Development related projects! Feel free to join and ask questions or leave suggestions :)

90% of ad revenue goes to creators

Support creators and Modrinth ad-free with Modrinth+

Compatibility

Minecraft: Java Edition

1.21.1

Platforms

Fabric

Supported environments

Singleplayer

Links

Report issues View source Join Discord server
Donate on Ko-fi

Creators

Stampede
Stampede Member

Details

Licensed MPL-2.0
Published 2 months ago
Updated 2 months ago

Modrinth is open source.

new-project-page@ac78952

© 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.