Solved Send commands to bungeecord

Discussion in 'Spigot Plugin Development' started by titivermeesch, Dec 6, 2018 at 11:14 AM.

  1. Hi there,

    I'm pretty new to the bungeecord API so maybe this is really simple, remember that I don't want to use any dependecies like BungeeEssentials.

    How do I make a system that will send a command to the bungee proxy server directly from the spigot plugin.
    Let's say I have a bunch of commands and I want my spigot plugin to tell the bungee server to execute them?

    Hope the question is clear ;)
  2. Make a bungee plugin instead of a spigot plugin?
  3. There need to be a bungeecord plugin I suppose to retreive the command, I heard about the messaging channel but no idea how that works. My spigot plugin should send a command to a bungeecord plugin and that plugin will execute the command I suppose
  4. I am not sure if you don't need a bungeecord plugin to be honest.
    I don't really understand why you want to use a spigot plugin to do something with bungecord.

    Now you want spigot -> bungeecord -> execute which can also be just bungeecord -> execute.
    since bungeecord commands can also be executed in a spigot server

    I am not sure if you can use a spigot plugin to send a packet to bungeecord since bungeecord hooks into spigot and not the other way around (Correct me if I'm wrong:eek:)
  5. The thing is that in the config of my plugin there is an option to enable or disable bungeecord, when it's enabled it should execute the command on the bungeecord server and not on the spigot server it's running on, maybe with redis or something like that, I don't know if the messaging channel work both ways
  6. EDIT: The thing is that I don't want 2 plugins, just 1
  7. you try commandsync no ?
    • Like Like x 1
  8. It need to be code and commandsync does bungeecord > Spigot, not Spigot > Bungeecord
  9. its not the discussion sorry, but commandsync can make Spigot > Bungeecord
    • Like Like x 1
  10. Ow I didn't know that, I'll look into that then
  11. You can try : /sync console bungee [command]

    if you need help i am hre i have use commandsync 4 years
    • Agree Agree x 1
    • Useful Useful x 1
  12. Use plugin messaging. Send a message to BungeeCord, listen to it on BungeeCord and do whatever you need to there, then send it back to Spigot. The plugin would need to be added for both Bungee and Spigot to do their respective tasks, though.
  13. I will look into messaging, thanks for your help. I'll let you know when I got something working
  14. Is it possible that you explain this to me in detail? Or a link to en example? I can't really find any good information page about it
  15. With that I understand how you send information to bungeecord, but how do I listen to them in bungeecord then?
    And when I try to send a message to Bungee it gives me :
    Code (Java):
    EOFException : null @
    Code (Java):
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
                        out.writeUTF("/alert This is a test");

                        Player player = Iterables.getFirst(Bukkit.getOnlinePlayers(), null);
                        player.sendPluginMessage(CommandTimer.getPlugin(), "BungeeCord", out.toByteArray());
  16. EDIT : I debugged it and there isn't any error with try/catch, nor with the sendPluginMessage, why is this happening then
    Code (Java):
    public static void sendBungee(Player p) {
            ByteArrayOutputStream b = new ByteArrayOutputStream();
            DataOutputStream out = new DataOutputStream(b);
            try {
                out.writeUTF("/alert Testing command distance");
            } catch(Exception e) {

            p.sendPluginMessage(getPlugin(), "BungeeCord", b.toByteArray());
    #17 titivermeesch, Dec 10, 2018 at 4:56 PM
    Last edited: Dec 10, 2018 at 5:02 PM
  17. Likely not enough arguments for the plugin message you're sending. You also need to write the player:
    Code (Java):
    out.writeUTF("Escad_"); // or "ALL"
  18. Ooooh that worked, thanks for your help
    • Like Like x 1

Share This Page