Solved Need Help

Discussion in 'Spigot Plugin Development' started by BGHDDevelopment, Aug 8, 2018.

Thread Status:
Not open for further replies.
  1. Hello spigot!

    I am currently facing an issue. I want a player to run a command on a spigot server and it to run on Bungeecord. I know the only way to do this is the bungee messaging channel.

    I have this code currently.

    Code (Text):
    public void executeBungeecordCommand(String command, Player player) {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        player.sendPluginMessage(Main.getInstance(), "BungeeCord", out.toByteArray());
    Here is the code I am using to execute the command:
    Code (Text):

    public void onClick(InventoryClickEvent e) {
        if (e.getInventory().getName().equals(InvNames.Main)) {
    Player p = (Player) e.getWhoClicked();
            if (e.getCurrentItem() == null)
            Account account = Core.getInstance().getAccountManager().getAccount(p.getUniqueId());
            if (e.getCurrentItem().equals(Items.Hacking(p))) {
                if (account.getRank().isHigher(Rank.MOD)) {
                    executeBungeecordCommand(p,"/ban " + bannedPlayer.getName() + " " + "Hacking/Using Blacklisted Modifications");
                    p.sendMessage(ChatColor.GREEN + "Command sent.");
    It does not seem to work and I am getting a error on the executeBungeecordCommand line. Any help would be great. The error has something to do with the "p" thats the player on that line.
  2. Optic_Fusion1

    Resource Staff

    try flipping the p and string?
    • Like Like x 1
    • Agree Agree x 1
  3. Wow. That fixed the issue with player. But it still is not working. I must have missed that.
    The command never sends to bungeecord apparently. Do you see anything else that could be causing the issue? I am clueless at this point.
  4. Optic_Fusion1

    Resource Staff

    I do not use bungeecord or plugin messaging and stuff like that so i have no clue, sorry
  5. Egg


    Take a look at the wiki!

    Use Forward in order to send these type of information.
  6. Inkzzz

    Resource Staff

    Did you register the outgoing channel?
    • Agree Agree x 1
    • Agree Agree x 1
  7. I have a bungeecord plugin, this spigot plugin is a GUI that needs to send commands to bungeecord.

    In terms of that ExcuteBungeeCommand I found it on a spigot thread I guess someone was wrong.


    Whats the best way to do this.
  8. In your BungeeCord plugin (Pro tip, there is a BungeeCord subforum), do the following:
    Hook the PluginMessage event, then handle your own plugin message. If you want to see how BungeeCord natively implements these, look here: Add something like BanPlayer which takes the name and the reason, or simply implement the ExecuteBungeeCommand functionality yourself.
Thread Status:
Not open for further replies.