From ce287cf218cd773020092967e75a30caea2188aa Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 8 Jun 2021 00:16:55 +0200 Subject: [PATCH 1/5] Add toggle allowing to opt out nashorn --- Bukkit/build.gradle | 4 ++-- Bukkit/pom.xml | 2 +- .../main/java/com/plotsquared/core/command/DebugExec.java | 6 ++++-- .../main/java/com/plotsquared/core/command/MainCommand.java | 5 ++++- .../java/com/plotsquared/core/configuration/Settings.java | 6 ++++++ 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 8b4503914..f14fd18cb 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -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") diff --git a/Bukkit/pom.xml b/Bukkit/pom.xml index a42a6fa55..76c10a368 100644 --- a/Bukkit/pom.xml +++ b/Bukkit/pom.xml @@ -185,7 +185,7 @@ org.incendo.serverlib ServerLib - 2.1.0 + 2.2.0 runtime diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java index 3591b7354..fe3ba0862 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java @@ -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; } diff --git a/Core/src/main/java/com/plotsquared/core/command/MainCommand.java b/Core/src/main/java/com/plotsquared/core/command/MainCommand.java index d52ac7a99..90f451172 100644 --- a/Core/src/main/java/com/plotsquared/core/command/MainCommand.java +++ b/Core/src/main/java/com/plotsquared/core/command/MainCommand.java @@ -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; } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index 988821265..b2bc1b6ce 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -593,6 +593,12 @@ public class Settings extends Config { public static List 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; } } From df842c355e3d9f634993a8725366a174bb588e98 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Tue, 8 Jun 2021 10:52:51 +0200 Subject: [PATCH 2/5] 5.13.13 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c20dec826..d459756f2 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ ext { git = Grgit.open(dir: new File(rootDir.toString() + "/.git")) } -def ver = "5.13.12" +def ver = "5.13.13" def versuffix = "" ext { if (project.hasProperty("versionsuffix")) { From e2700d3b283eab53bd5b132cf0d2e087b1776962 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Thu, 10 Jun 2021 11:41:55 +0100 Subject: [PATCH 3/5] Implement "off" to PlotWeather flag and make it default - Players with "player weather" will no longer have their weather reset on plots that do not set the PlotWeather flag --- .../com/plotsquared/bukkit/player/BukkitPlayer.java | 6 ++++-- .../com/plotsquared/core/listener/PlotListener.java | 5 +++-- .../java/com/plotsquared/core/plot/PlotWeather.java | 5 ++++- .../core/plot/flag/implementations/WeatherFlag.java | 12 +++++++++--- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java index 704aa0f6d..317e79ca4 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/player/BukkitPlayer.java @@ -276,10 +276,12 @@ public class BukkitPlayer extends PlotPlayer { case RAIN: this.player.setPlayerWeather(WeatherType.DOWNFALL); break; - case RESET: - default: + case WORLD: this.player.resetPlayerWeather(); break; + default: + //do nothing as this is PlotWeather.OFF + break; } } diff --git a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java index 8d95121ff..b90682115 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java @@ -362,13 +362,14 @@ public class PlotListener { } } + if (plot.getFlag(TimeFlag.class) != TimeFlag.TIME_DISABLED.getValue().longValue()) { player.setTime(Long.MAX_VALUE); } final PlotWeather plotWeather = plot.getFlag(WeatherFlag.class); - if (plotWeather != PlotWeather.CLEAR) { - player.setWeather(PlotWeather.RESET); + if (plotWeather != PlotWeather.OFF) { + player.setWeather(PlotWeather.WORLD); } Location lastLoc = player.getMeta("music"); diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotWeather.java b/Core/src/main/java/com/plotsquared/core/plot/PlotWeather.java index f93d7970b..2ab253e54 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotWeather.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotWeather.java @@ -26,5 +26,8 @@ package com.plotsquared.core.plot; public enum PlotWeather { - RAIN, CLEAR, RESET + RAIN, + CLEAR, + WORLD, + OFF } diff --git a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java index 5c62a2daa..897b298ac 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java +++ b/Core/src/main/java/com/plotsquared/core/plot/flag/implementations/WeatherFlag.java @@ -37,7 +37,8 @@ public class WeatherFlag extends PlotFlag { public static final WeatherFlag PLOT_WEATHER_FLAG_RAIN = new WeatherFlag(PlotWeather.RAIN); public static final WeatherFlag PLOT_WEATHER_FLAG_CLEAR = new WeatherFlag(PlotWeather.CLEAR); - public static final WeatherFlag PLOT_WEATHER_FLAG_OFF = new WeatherFlag(PlotWeather.RESET); + public static final WeatherFlag PLOT_WEATHER_FLAG_WORLD = new WeatherFlag(PlotWeather.WORLD); + public static final WeatherFlag PLOT_WEATHER_FLAG_OFF = new WeatherFlag(PlotWeather.OFF); /** * Construct a new flag instance. @@ -60,8 +61,11 @@ public class WeatherFlag extends PlotFlag { case "off": case "sun": return flagOf(PlotWeather.CLEAR); + case "reset": + case "world": + return flagOf(PlotWeather.WORLD); default: - return flagOf(PlotWeather.RESET); + return flagOf(PlotWeather.OFF); } } @@ -83,6 +87,8 @@ public class WeatherFlag extends PlotFlag { return PLOT_WEATHER_FLAG_RAIN; case CLEAR: return PLOT_WEATHER_FLAG_CLEAR; + case WORLD: + return PLOT_WEATHER_FLAG_WORLD; default: return PLOT_WEATHER_FLAG_OFF; } @@ -90,7 +96,7 @@ public class WeatherFlag extends PlotFlag { @Override public Collection getTabCompletions() { return Arrays - .asList("rain", "storm", "on", "lightning", "thunder", "clear", "off", "sun", "reset"); + .asList("rain", "storm", "on", "lightning", "thunder", "clear", "off", "sun", "reset", "world"); } } From b01291c4ff78fd74240f0125c10bb6f729cf90b0 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 12 Jun 2021 11:36:33 +0100 Subject: [PATCH 4/5] Add note about PlayerPlotAutoEvent return null plot --- .../java/com/plotsquared/core/events/PlayerAutoPlotEvent.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Core/src/main/java/com/plotsquared/core/events/PlayerAutoPlotEvent.java b/Core/src/main/java/com/plotsquared/core/events/PlayerAutoPlotEvent.java index 12d44ff47..3cb8d7f74 100644 --- a/Core/src/main/java/com/plotsquared/core/events/PlayerAutoPlotEvent.java +++ b/Core/src/main/java/com/plotsquared/core/events/PlayerAutoPlotEvent.java @@ -33,6 +33,9 @@ import lombok.Setter; import javax.annotation.Nullable; +/** + * PlayerAutoPlotEvent returns null for {@code PlotEvent.getPlot()} as the event is fired before the plot is chosen. + */ public class PlayerAutoPlotEvent extends PlotEvent implements CancellablePlotEvent { private Result eventResult; From 93568f9f7fef4bc7264484364f5693a2800dbef8 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 12 Jun 2021 12:09:40 +0100 Subject: [PATCH 5/5] Update pom --- Bukkit/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bukkit/pom.xml b/Bukkit/pom.xml index 76c10a368..ca8656da8 100644 --- a/Bukkit/pom.xml +++ b/Bukkit/pom.xml @@ -21,7 +21,7 @@ com.plotsquared PlotSquared-Core - 5.13.12 + 5.13.13 compile