diff --git a/pom.xml b/pom.xml index 55d3408c..b9ccb493 100644 --- a/pom.xml +++ b/pom.xml @@ -202,6 +202,11 @@ reflectionhelper 1.18.4-SNAPSHOT + + org.openjdk.nashorn + nashorn-core + 15.3 + diff --git a/src/main/java/de/epiceric/shopchest/config/HologramFormat.java b/src/main/java/de/epiceric/shopchest/config/HologramFormat.java index 6e50ddf4..c1e1ba3e 100644 --- a/src/main/java/de/epiceric/shopchest/config/HologramFormat.java +++ b/src/main/java/de/epiceric/shopchest/config/HologramFormat.java @@ -7,7 +7,7 @@ import java.util.regex.Pattern; import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; +import javax.script.ScriptEngineFactory; import javax.script.ScriptException; import org.bukkit.configuration.ConfigurationSection; @@ -15,6 +15,7 @@ import de.epiceric.shopchest.ShopChest; import de.epiceric.shopchest.utils.Operator; +import org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory; public class HologramFormat { @@ -31,8 +32,8 @@ public enum Requirement { // e.g.: "STONE" == "DIAMOND_SWORD" private static final Pattern SIMPLE_STRING_CONDITION = Pattern.compile("^\"([^\"]*)\" ([=!]=) \"([^\"]*)\"$"); - private ScriptEngineManager manager = new ScriptEngineManager(); - private ScriptEngine engine = manager.getEngineByName("JavaScript"); + private ScriptEngineFactory factory = new NashornScriptEngineFactory(); + private ScriptEngine engine = factory.getScriptEngine(); private ShopChest plugin; private File configFile;