promotional bannermobile promotional banner
premium banner
This mod provides a custom event `NetMessageReceivedEvent` that is fired whenever the LocalNetBridge receives a message on port 55000. Other mods can listen to this event to handle incoming messages.

Description

NetMsg 

Looking for a fun PVP experience on a stable server?

Join HYDMG.COM
IP: hydmg.com

This mod provides a custom event NetMessageReceivedEvent that is fired whenever the LocalNetBridge receives a message on port 55000. Other mods can listen to this event to handle incoming messages.

Listening for Messages

To listen for messages, you need to register a listener for NetMessageReceivedEvent.

 

Example Listener

import com.hydmg.netmsg.event.NetMessageReceivedEvent;
import com.hypixel.hytale.server.core.plugin.JavaPlugin;

public class MyModListener {
    public void onMessageReceived(NetMessageReceivedEvent event) {
        String message = event.getMessage();
        System.out.println("Received message: " + message);
        // Process the message...
    }
}

Registering the Listener

 

In your mod's setup method:

@Override
protected void setup() {
    MyModListener listener = new MyModListener();
    getEventRegistry().registerGlobal(NetMessageReceivedEvent.class, listener::onMessageReceived);
}

Event Details

  • Class: com.hydmg.netmsg.event.NetMessageReceivedEvent
  • Method: getMessage() returns the String content of the received message.

Sending Messages

To send a message to the bridge from the command line, you can use curl:

curl -X POST -d "Hello, Hytale!" http://localhost:55000

 

Mods Currently using netmsg

Created By

 

Use code asonia to support us!