RHazDev / Socket4MC

Sockets for Minecraft servers



You don’t like Plugin Messaging Channels? You want to use sockets but you think it’s too difficult for you? This API allows developers to send data from Bungee to Spigot/Sponge and from Spigot/Sponge to Bungee.

♦ Use Sockets (in case you haven’t understood yet)

♦ Very easy-to-use

♦ Call Bungee and Spigot/Sponge events

♦ Lightweight, fast, efficient

♦ Encrypted data transfer (RSA encryption)

You have to install and configure Socket4MC on BungeeCord and on all your Spigot/Sponge servers

BungeeCord configuration:

port: 25575
name: "mybungeecord"
security-level: 1

Spigot/Sponge configuration:

host: "localhost"
port: 25575
name: "mysponge" // or "factions", "lobby", ...
security-level: 1

♦ host: BungeeCord’s address (e.g. mc.rhaz.fr, localhost) Set it to localhost if you don’t know what is it

♦ port: A port used for communication (needs to be the same for all servers) MUST BE AN OPENED PORT // NOT THE SAME AS YOUR BUNGEECORD PORT

♦ name: The server name (e.g. Factions, SmashBros) in lower case


0=no security,

1=AES encryption,

2=AES encryption and RSA keys sent

----------------- on Sponge -------------------

// Send a message "Ping!" to BungeeCord over channel "MyChannel"
public void sendPing()
	JSONMap map = new JSONMap(
		"message", "Ping!"

	Socket4Sponge.getClient().writeJSON("MyChannel", map);

// Send it when it is connected
public void onHandshake(ClientSocketHandshakeEvent e){

------------------- on BungeeCord -------------------

public void onEnable() {
   getProxy().getPluginManager().registerListener(this, this);

// Receive a message "Ping!" from Spigot and send "Pong!"
public void onSocketMessage(ServerSocketJSONEvent e){

	String channel = e.getChannel(); // The channel name
	if(!channel.equals("MyChannel")) return;

	String name = e.getName(); // The name of the server

	String message = e.getExtraString("message");
	getLogger().info("Received message from " + name + ": " + message);

		e.write("message", "Pong!"); // Quick reply to this channel



Category: Developer Tools

Published on May 06, 2018


7 total downloads