mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 11:59:26 +00:00
Added config to optionally enable/disable the ECMA6 Javascript standard in scripts.
This commit is contained in:
1 parent
b7eb70dd31
commit
ed0290217f
2 files changed
+6
-1
No files matched your search
@@ -47,6 +47,11 @@ public class CustomNpcs {
|
||||
@ConfigProp(info = "Enables/Disables ALL scripting. You can still see and write code in the scripter, but these scripts won't run. True by default")
|
||||
public static boolean ScriptingEnabled = true;
|
||||
|
||||
@ConfigProp(info = "Enables/Disables the use of the the ECMA6 Javascript standard instead of ECMA5.1." +
|
||||
"\nEnabling this adds many more features to JS in scripts, but may cause some scripts to break" +
|
||||
"\non servers that run Java 8 or lower. Disabled by default.")
|
||||
public static boolean ScriptingECMA6 = false;
|
||||
|
||||
@ConfigProp(info = "Enables global player event scripts to be used in the scripter. You can still see and write code in the scripter, but these scripts won't run. True by default.")
|
||||
public static boolean GlobalPlayerScripts = true;
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ public class ScriptContainer {
|
||||
public void setEngine(String scriptLanguage) {
|
||||
if(currentScriptLanguage != null && currentScriptLanguage.equals(scriptLanguage))
|
||||
return;
|
||||
if (scriptLanguage.equals("ECMAScript")) {
|
||||
if (CustomNpcs.ScriptingECMA6 && scriptLanguage.equals("ECMAScript")) {
|
||||
System.setProperty("nashorn.args", "--language=es6");
|
||||
}
|
||||
engine = ScriptController.Instance.getEngineByName(scriptLanguage.toLowerCase());
|
||||
|
||||
Reference in new issue
Block a user