Setting's parenthesis
Guillaume-Lebegue opened this issue · 0 comments
Description
Describe the bug
Error when using parenthesis for configuration.
Java lambda doesn't get good variables
The way this part of the algorithm work is by setting an int to the start of the number and then another int to an end of the number
example: (2+5)
start = 1 and end = 2
So by using substring, it can get 2.
The first part of the parenthesis always works, but the second, at the moment the lambda is set, start and end are well placed, but when the lambda run, end is all the way to the end of the string so substring get '5)' and it can't parse it to a number
Steps to reproduce the behavior
Using parenthesis for computing things in the config, like vaultCost
Screenshots and videos (Optional)
In src/main/java/world/bentobox/upgrades/config/Settings.java
line 460
if ((ch >= '0' && ch <= '9') || ch == '.') { // numbers
while ((ch >= '0' && ch <= '9') || ch == '.') nextChar();
x = (() -> Double.parseDouble(str.substring(startPos, this.pos)));
if I try to show startPos and this.pos after the while, this is good.
But if I try to display them in the lambda, this.pos is at the end.
Environment
BentoBox Version (Mandatory)
No relation
Additional context (Optional)
I have for now deactivated this functionality by commenting it.
I think this problem come from the variable scope of the lambda and I'm not good enough with them yet to solve this problem.