Solved Send player to server on join

Discussion in 'BungeeCord Plugin Development' started by Cubixor, Feb 20, 2020.

Thread Status:
Not open for further replies.
  1. I want to send player to specific server when he joins bungeecord network. I used PostLoginEvent, checked a few things and used:
    Code (Text):
    The problem is that if player was in this server and logged out, he is automatically connected to it by bungeecord and the second time by my plugin. Because of that he recives message: "Already connecting to to this server".
    So how to check if player is on this server that I want to put him on? getPlayer().getServer() returns null. Maybe there is better event to do this? Please help.
  2. When you are using PostLoginEvent, the player is still connecting to the proxy, he is not on the server.
    But I want to know why do you what to create a plugin when BungeeCord is already doing this job perfectly
  3. I am working at lobby selector plugin which allows you to create many lobbies like on big networks (hypixel, hivemc). I need to put players on random lobby or lobby which is not full on join.

    Plugin connects me to server one on join. I am on server one, I log out. When I log in plugin is trying to send me to the one server and when I appear on world I have message on chat "Allready connecting to this server". So player is sent to server twice. How to prevent this?
    #3 Cubixor, Feb 20, 2020
    Last edited: Feb 20, 2020
  4. Server join priority. Already present in bungeecord's config.
  5. Could you explain it? What should I do to remove this bug?
  6. What bug are you talking about? You have a yaml list called "priorities" where you can specify the servers. BungeeCord will automatically redirect the player to the next server if the server it was previously trying to connect is offline or is full.
  7. You are talking about completly other thing. Player was connected to the server twice: once by bungeecord and once by my plugin.

    I found how to solve it by myself. I used ServerConnectEvent instead of PostLoginEvent and did this:
    Code (Java):

    My problem was resolved.
    • Like Like x 1
Thread Status:
Not open for further replies.