Problem sending players to the lobby servers.

Discussion in 'BungeeCord Plugin Development' started by Xuho, May 26, 2018.

  1. I'm using this code to send my players to the lobby server when the server they were stop working or is restarting.
    Code (Text):
         @EventHandler(priority = EventPriority.HIGH)
            public void onKick(final ServerKickEvent event) {
                final ProxiedPlayer p = event.getPlayer();
                if (event.getPlayer().getServer() != null) {
                    if (event.getPlayer().getServer().getInfo().getName().equalsIgnoreCase("prelobby")) {
                        core.getProxy().getScheduler().schedule(core, new Runnable() {
                            public void run() {
                                int random = (int) (Math.random() * 3.0 + 1.0);
                                if (random == 1) {
                                if (random == 2) {
                                if (random == 3) {
                        }, 10l, TimeUnit.MILLISECONDS);
    The problem is that this only works with like 1/5 of the players, the others 4/5 are sent to the fallback server.
    What I have to change or what I have to do to fix this?
  2. Have you tried making the runnable run after a smaller delay and not 10 ticks?
  3. Is it a time-problem or is it a bug caused by your random integer method?
  4. Yes but it works worse
  5. the random integer works well.
  6. Can't you intercept the event where the player is moved to a server and then set the target server? Or even set the target server in this event?
  7. The Code that I have now works. The problem comes when for example the bungeecord needs to send a big amount of players to the lobbies like 1/4 of the players are sent correctly and the other 3/4 are sent to the prelobby (fallback servers)

    Anyway what event are you talking about?
  8. This has always worked for me on crashes and restarts; - upload_2018-5-30_17-15-47.png
  9. But I dont want the players to be sent to the fallback server...
  10. Not sure if you can set more than one default_fallback server, try that first.
  11. just try checking your priorities in bungee's config.yml and closing prelobby's connection in serverkickevent. Not sure if it could solve your problems.