Change call to ScriptEngineManager

This commit is contained in:
Aurora 2020-07-06 16:14:59 +02:00
parent 29af6cb38f
commit 4a769e95bd
No known key found for this signature in database
GPG Key ID: 89839F67B53656AD

View File

@ -218,7 +218,7 @@ public class Furnace {
String equation = "(" + level.getPerformance() + " / 100) * " + cap; String equation = "(" + level.getPerformance() + " / 100) * " + cap;
try { try {
if (!cache.containsKey(equation)) { if (!cache.containsKey(equation)) {
ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngineManager mgr = new ScriptEngineManager(null);
ScriptEngine engine = mgr.getEngineByName("JavaScript"); ScriptEngine engine = mgr.getEngineByName("JavaScript");
int num = (int) Math.round(Double.parseDouble(engine.eval("(" + level.getPerformance() + " / 100) * " + cap).toString())); int num = (int) Math.round(Double.parseDouble(engine.eval("(" + level.getPerformance() + " / 100) * " + cap).toString()));
cache.put(equation, num); cache.put(equation, num);