// HandlePingPacket handles a ping packet used by the Minecraft client // used to measure the round trip time of the connection. func HandlePingPacket(s protocol.Stream, status Status) error { if !status.ShowConnection { s.ReadInt64() return nil } time, err := s.ReadInt64() if err != nil { return err } responsePacket := protocol.NewPacketWithID(0x01) responsePacket.WriteInt64(time) err = s.WritePacket(responsePacket) return err }