Hello,
i know that sponge has no multiserver communication, but is there any way to get this code working?
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream os= new DataOutputStream(bos);
os.writeUTF("Connect");
os.writeUTF("Hub-Server");
player.sendPluginMessage(plugin, "BungeeCord", bos.toByteArray());
bos.close();
os.close();
That Code is from an Bukkit Plugin. I have no idea how to replace player.sendPluginMessage(plugin, “BungeeCord”, baos.toByteArray());
Or must i create an plugin for Bungeecord to communicate?
Greetings,
Marco
1 Like
I assume you’re looking for this:
player.getConnection().sendCustomPayload(plugin, "BungeeCord", bos.toByteArray());
I’m not sure if you have to register the channel if you’re only going to send messages. If you have to, there is a registerChannel
method in the server class.
/** * Registers the given channel to the plugin. * * @param plugin The plugin registering the channel * @param listener The listener that will listen for * @param channel The channel to register * @throws ChannelRegistrationException The channel name is too long * @throws ChannelRegistrationException The channel name is reserved */ void registerChannel(Object plugin, ChannelListener listener, String channel) throws ChannelRegistrationException; /** * Gets the list of registered channels. * * <p>Channel registration is a global registration, all clients * will automatically be registered with the given channels on the * server and vice versa.</p> * * @return A copy of the list of channels */