Lucene Upgrade Help for Addon

Hi, I’m trying to update an addon to make it work with the newer Lucene version (7.3) used in JIRA 8.
This isn’t my addon but another developer, who appears to have disappeared from the project (I’ve even asked Atlassian if they can contact him, but they’ve not been able to either).
Fortunately the source code is on the addon site so I can try and update it, although I’m no Java expert.
https://bitbucket.org/treymarc/jira-stattable-searchers/wiki/Home

So far I’ve got it building and running OK for JIRA 8, but for the particular field I’m looking at I’m getting strange values.
The addon allows you to use normal numerical fields in statistical gadgets like pie charts or 2D tables.
My fields would have integer numbers (i.e. 1, 2, 3 or 4). This would allow me to show the number of issues which have the value 1, 2, 3 or 4 etc.
What happens in JIRA 8 is that the values are no longer shown as 1, 2, 3 or 4 but really large integer numbers, 4,619,567,317,775,286,300 or 4,607,182,418,800,017,400 but the statistical counts look correct still.
So far I’ve tracked the issue down to the code in NumberStatisticMapper in the Object getValueFromLuceneField(String documentValue). The documentValue is very different to what I see on JIRA 7, and is the values I’ve listed above.
However I don’t know how it’s getting this documentValue.

Has anyone had any experience with updating their addon for the Lucene upgrade in JIRA 8 and could help me with this?
I’m planning on sharing my solution with other users of the addon who also want to use it on JIRA 8.

I’ve found a bit more time to work through this and try to understand how it works.
I’ve also found that the plugin is triggered when viewing issues in a search result and gives the correct values for documentValue
/rest/issueNav/1/issueTable [e.k.jira.searchers.NumericStatisticMapper] documentValue 00000000000012.000

But in the gadget I get the very large integer numbers
/rest/gadget/1.0/statistics [e.k.jira.searchers.NumericStatisticMapper] documentValue 4622945017495814144

Looking through the logs and code more it seems to use the following function to transform the value from the index to the correct output, but I’m not sure why this doesn’t work in the gadget
customFieldInputHelper com.atlassian.jira.issue.customfields.searchers.transformer.DefaultCustomFieldInputHelper@6caeb746