I encountered this problem, sending from a Paper Server a message (containing the command to be executed as String) through this code:
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF(executor.getExecutable().replace("%player%",player.getName()));
System.out.println(executor.getExecutable().replace("%player%", player.getName()));
player.sendPluginMessage(plugin, "hqueue:inventory", out.toByteArray());
(executor.getExecutable() returns a Command as String)
Bungeecord receives these value when made a Println through this code:
@EventHandler
public void onPluginMessageReceived(PluginMessageEvent event) {
System.out.println("Data received: " + new String(event.getData()) + " --r");
if(!event.getTag().equals("hqueue:inventory")) return;
System.out.println("Data received: " + new String(event.getData()));
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), new String(event.getData()));
}
Println results:
11:04:29 [INFO] Data received: §queue add Jaamin test --r
11:04:29 [INFO] Data received: §queue add Jaamin test
(§ with some extras spaces shouldn't be there)
And rightly, the command is not executed as it does not exist in that form.