Solved Check if BungeeCord server is online

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

  1. I'm currently learning BungeeCord plugin development and my idea was to create a custom server for banned players. So I created ban command, saved banned players' UUIDs in a file and with ServerSwitchEvent I checked if they are banned or not (I also tried PostLoginEvent and ServerConnectedEvent). If they were banned I connected them with
    Code (Java):
    with e being event and plugin being main class
    This worked fine for connecting players. The problem is that if that server is offline they can just stay in normal servers and they will just get an error in chat about the server being offline. So how can I check if BungeeCord servers are online before I try to connect to them?
  2. ServerInfo#ping

    if exception != null -> offline
    if exception == null -> online
  3. I'm not completely sure how to get this to work. Can you please send some example code with ServerInfo#ping ?
    Nvm, I found this