@Override
 public void handle(Packet0KeepAlive alive) throws Exception {
   if (alive.getRandomId() == con.getSentPingId()) {
     int newPing = (int) (System.currentTimeMillis() - con.getSentPingTime());
     bungee.getTabListHandler().onPingChange(con, newPing);
     con.setPing(newPing);
   }
 }
  @Override
  public void disconnected(ChannelWrapper channel) throws Exception {
    // We lost connection to the client
    PlayerDisconnectEvent event = new PlayerDisconnectEvent(con);
    bungee.getPluginManager().callEvent(event);
    bungee.getTabListHandler().onDisconnect(con);
    BungeeCord.getInstance().removeConnection(con);

    if (con.getServer() != null) {
      con.getServer().disconnect("Quitting");
    }
  }
  public UpstreamBridge(ProxyServer bungee, UserConnection con) {
    this.bungee = bungee;
    this.con = con;

    BungeeCord.getInstance().addConnection(con);
    bungee.getTabListHandler().onConnect(con);
    con.unsafe().sendPacket(BungeeCord.getInstance().registerChannels());

    TexturePackInfo texture = con.getPendingConnection().getListener().getTexturePack();
    if (texture != null) {
      con.setTexturePack(texture);
    }
  }