Solved Connecting player to server with BungeeCord

Discussion in 'Plugin Development' started by Philitup321, Sep 3, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Philitup321

    Hello!! I am trying to make a command that will connect the player to another server in a BungeeCord network. I have tried :
    Code:java
    1. player.performCommand("server survival");
    And it doesn't work, and everything else that I have tried hasn't worked out.
     
  2. Offline

    JPG2000

    Philitup321 Maby try
    Code:java
    1. player.chat("/server survival");
     
    carlgo11 and StaticE like this.
  3. Offline

    StaticE

    Not going to work because Bungeecord isn't a Bukkit plugin, it's a standalone jar/proxy. There's a super easy way to do this I just forget what it is, just check out this forum post and you'll probably find what you're looking for.

    Also, this is probably going to be locked because BungeeCord isn't supported on Bukkit.
     
  4. Offline

    Philitup321

    Thanks!! Yours works!! I can't believe I didn't think of that :p
     
  5. Offline

    StaticE

    Philitup321 Wu wu wut? That actually worked? I was almost certain that didn't work with BungeeCord.
     
  6. Offline

    Philitup321

    I thought that too. :eek:
     
  7. Offline

    kbunkrams97

    StaticE Philitup321
    Well it is just making the player send a chat message with the command. So as long as the player has access to the command it should work.
     
  8. Offline

    tommycake50

    Well tbh the proper way to do it is plugin channels :confused: and im clueless as to how that possibly worked.
     
  9. Offline

    StaticE

    This is what I was going to suggest:
    Code:java
    1. Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
    2.  
    3.  
    4. try {
    5. out.writeUTF("Connect");
    6. out.writeUTF("server name");
    7. } catch (IOException ex) {
    8.  
    9. }
    10. p.sendPluginMessage(this, "BungeeCord", b.toByteArray());


    Edit: Merged my double post woo
    kbunkrams97 True dat kb
     
    tommycake50 likes this.
  10. Offline

    Philitup321

    Ok, thanks. I will try your way as well.
     
  11. Offline

    StaticE

    Philitup321 Psh don't bother, if that other methods works use it, less code lol
     
  12. Offline

    Lordmaxi55

    Code:
        public void teleportServer(Player p, String server){
            ByteArrayOutputStream b = new ByteArrayOutputStream();
            DataOutputStream out = new DataOutputStream(b);
     
            try {
                out.writeUTF("Connect");
                out.writeUTF(server);
            } catch (IOException eee) {
                // Fehler
            }
     
            p.sendPluginMessage(this, "BungeeCord", b.toByteArray());
        }

    Use that code.
     
  13. StaticE
    Lordmaxi55
    I know this is an old thread but which ByteArrayOutputSteam and DataOutputStream do I import? Thanks!
     
Thread Status:
Not open for further replies.

Share This Page