BungeeCord Plugin Channel

Hello, first of all, excuse me for my English a little hazardous, I am a French student, and my English is a big point on which I have to improve myself ^^

I was wondering if there was an equivalent in the sponge API to this in the spigot API or Bukkit?

ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Subchannel");
out.writeUTF("Argument");

Player player = Bukkit.getPlayerExact("Example");

player.sendPluginMessage(this, "BungeeCord", out.toByteArray());

It’s really convenient for players to switch between different servers without logging out.
Here, you can find the documentation https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/

Thank’s for your help !

1 Like

FRENCH
Salut, t’as de la chance y’a quelques Français sur le forums :stuck_out_tongue:
Effectivement il y a une API pour faire ca, je suis pas familier avec mais elle est très propre il me semble (comme la plupart de SpongeAPI :slight_smile:)
Tu n’es pas obligé d’utiliser cette librairie mais voici un très bon exemple pour ce que tu souhaites faire : GitHub - pie-flavor/BungeeLib: A library for working with BungeeCord.
J’espère juste que l’API n’a pas changé depuis.

ENGLISH
Hi, you’re lucky there are some French on the forums :stuck_out_tongue:
Indeed there is an API to do this, I’m not familiar with it but it seems very clean to me (like most of SpongeAPI :slight_smile:)
You do not have to use this library but here is a very good example for what you want to do: GitHub - pie-flavor/BungeeLib: A library for working with BungeeCord.
I just hope the API has not changed since.

1 Like

FRENCH
Merci bien pour ta réponse rapide, je vais regarder cela, mais à première vue c’est parfaitement ce que je cherche.

Je n’ai pas encore vérifié si ça fonctionne encore, cependant cela m’a donné une idée du principe/ fonctionnement . Je pourrais tenté de bricoler :wink:

ENGLISH
Thank you for your quick answer, I’ll look at that, but at first glance that’s exactly what I’m looking for.

I have not checked yet if it still works, however it gave me an idea of ​​the principle. I could try to tinker :wink:

No French here, sorry.

I haven’t updated it in a while. I don’t know whether it still works. To answer your question on how to do that exact operation in Sponge:

Player player = Sponge.getServer().getPlayer("Example").get();
Sponge.getChannelRegistrar().getOrCreateRaw(this, "BungeeCord").sendTo(player, buf -> buf.writeUTF("Subchannel").writeUTF("Argument"));
1 Like

That’s perfect, thank’s !

1 Like