Add toggle allowing to opt out nashorn

This commit is contained in:
NotMyFault 2021-06-08 00:16:55 +02:00
parent a01ad5aa04
commit ce287cf218
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
5 changed files with 17 additions and 6 deletions

View File

@ -42,7 +42,7 @@ dependencies {
compile("se.hyperver.hyperverse:Core:0.6.0-SNAPSHOT"){ transitive = false }
compile('com.sk89q:squirrelid:1.0.0-SNAPSHOT'){ transitive = false }
compile('be.maximvdw:MVdWPlaceholderAPI:3.1.1'){ transitive = false }
implementation("org.incendo.serverlib:ServerLib:2.1.0")
implementation("org.incendo.serverlib:ServerLib:2.2.0")
}
sourceCompatibility = 1.8
@ -102,7 +102,7 @@ shadowJar {
include(dependency("org.khelekore:prtree:1.7.0-SNAPSHOT"))
include(dependency("com.sk89q:squirrelid:1.0.0-SNAPSHOT"))
include(dependency("com.intellectualsites.paster:Paster:1.0.2-SNAPSHOT"))
include(dependency("org.incendo.serverlib:ServerLib:2.1.0"))
include(dependency("org.incendo.serverlib:ServerLib:2.2.0"))
}
relocate('net.kyori.text', 'com.plotsquared.formatting.text')
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")

View File

@ -185,7 +185,7 @@
<dependency>
<groupId>org.incendo.serverlib</groupId>
<artifactId>ServerLib</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>

View File

@ -109,8 +109,10 @@ public class DebugExec extends SubCommand {
}
public ScriptEngine getEngine() {
if (this.engine == null) {
init();
if (!Settings.Enabled_Components.DISABLE_NASHORN_SCRIPT_ENGINE) {
if (this.engine == null) {
init();
}
}
return this.engine;
}

View File

@ -107,7 +107,6 @@ public class MainCommand extends Command {
new Music();
new DebugRoadRegen();
new Trust();
new DebugExec();
new FlagCommand();
new Target();
new Move();
@ -139,6 +138,10 @@ public class MainCommand extends Command {
// Referenced commands
instance.toggle = new Toggle();
instance.help = new Help(instance);
if (!Settings.Enabled_Components.DISABLE_NASHORN_SCRIPT_ENGINE) {
new DebugExec();
}
}
return instance;
}

View File

@ -593,6 +593,12 @@ public class Settings extends Config {
public static List<String> TAB_COMPLETED_ALIASES = Arrays.asList("plot", "plots", "p", "plotsquared", "plot2", "p2", "ps", "2", "plotme", "plotz", "ap");
@Comment("Whether PlotSquared should hook into MvDWPlaceholderAPI or not")
public static boolean USE_MVDWAPI = true;
@Comment({"Whether the Nashorn scripting engine should be enabled or not. Disabling this will ensure compatibility with Java 15+ by sacrificing scripting via Nashorn.",
"This is a temporary option going to be removed within the next major release (1.17/v6) where this issue has been addressed sanely without sacrifices but allowing you to update your Java version beforehand without loosing half of PlotSquared's commands.",
"By setting the following to true you eliminate:",
" - The functionality to use javascript in the worlds.yml prices' section",
" - The `/plot debugexec` command"})
public static boolean DISABLE_NASHORN_SCRIPT_ENGINE = false;
}
}