From bd9e2373769aaebb4817038b4f244edcb6d6ffd3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 26 Nov 2021 10:37:06 +0100 Subject: [PATCH 1/3] build: Update dependency org.mockito:mockito-core to v4.1.0 (#1435) Co-authored-by: Renovate Bot --- gradle/libs.versions.toml | 2 +- worldedit-sponge/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8b6f03ee5..95ea40e2e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -51,7 +51,7 @@ text = "3.0.4" piston = "0.5.7" # Tests -mockito = "4.0.0" +mockito = "4.1.0" checker-qual = "3.19.0" # Gradle plugins diff --git a/worldedit-sponge/build.gradle.kts b/worldedit-sponge/build.gradle.kts index 871c65087..b209fd03e 100644 --- a/worldedit-sponge/build.gradle.kts +++ b/worldedit-sponge/build.gradle.kts @@ -28,7 +28,7 @@ dependencies { }) api("org.apache.logging.log4j:log4j-api") api("org.bstats:bstats-sponge:1.7") - testImplementation("org.mockito:mockito-core:4.0.0") + testImplementation("org.mockito:mockito-core:4.1.0") } <<<<<<< HEAD From 11e25911d5847b3a9b212b18c1f31c0755fe22de Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 26 Nov 2021 23:31:27 +0100 Subject: [PATCH 2/3] upstream: Update upstream (#1430) * upstream: Update upstream c407471 Re-add class shutter with tweaks. (1947) * upstream: Update Upstream 29f1c66 If a trace hits the world limit, cancel it (1942) * upstream: Update upstream 511daa5 Update paperweight dev bundle --- .../adapters/adapter-1_17_1/build.gradle.kts | 2 +- .../MinecraftHidingClassShutter.java | 34 +++++++++++++++++++ .../scripting/RhinoCraftScriptEngine.java | 1 + .../com/sk89q/worldedit/util/TargetBlock.java | 10 +++--- 4 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/scripting/MinecraftHidingClassShutter.java diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_17_1/build.gradle.kts index f48780506..218701aae 100644 --- a/worldedit-bukkit/adapters/adapter-1_17_1/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_17_1/build.gradle.kts @@ -3,7 +3,7 @@ plugins { } applyPaperweightAdapterConfiguration( - "1.17.1-R0.1-20211109.085555-183" + "1.17.1-R0.1-20211120.192557-194" ) repositories { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/MinecraftHidingClassShutter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/MinecraftHidingClassShutter.java new file mode 100644 index 000000000..e016335c2 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/MinecraftHidingClassShutter.java @@ -0,0 +1,34 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.scripting; + +import org.mozilla.javascript.ClassShutter; + +/** + * Hides Minecraft's obfuscated names from scripts. + */ +class MinecraftHidingClassShutter implements ClassShutter { + + @Override + public boolean visibleToScripts(String fullClassName) { + return fullClassName.contains(".") || fullClassName.length() >= 4; + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/RhinoCraftScriptEngine.java b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/RhinoCraftScriptEngine.java index 5326317ef..07e18b71c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/RhinoCraftScriptEngine.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/RhinoCraftScriptEngine.java @@ -50,6 +50,7 @@ public class RhinoCraftScriptEngine implements CraftScriptEngine { throws Throwable { RhinoContextFactory factory = new RhinoContextFactory(timeLimit); Context cx = factory.enterContext(); + cx.setClassShutter(new MinecraftHidingClassShutter()); ScriptableObject scriptable = new ImporterTopLevel(cx); Scriptable scope = cx.initStandardObjects(scriptable); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java index cb83d5873..4c93fafd2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java @@ -170,17 +170,15 @@ public class TargetBlock { * @return Block */ public Location getAnyTargetBlock() { - boolean searchForLastBlock = true; Location lastBlock = null; while (getNextBlock() != null) { if (stopMask.test(targetPos)) { break; } else { - if (searchForLastBlock) { - lastBlock = getCurrentBlock(); - if (lastBlock.getBlockY() <= world.getMinY() || lastBlock.getBlockY() >= world.getMaxY()) { - searchForLastBlock = false; - } + lastBlock = getCurrentBlock(); + if (lastBlock.getBlockY() < world.getMinY() + || lastBlock.getBlockY() > world.getMaxY()) { + return null; } } } From 05c22a68022b8f018ad56c6ceed191da18debec4 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 27 Nov 2021 12:21:38 +0100 Subject: [PATCH 3/3] build: Update paperlib (#1439) --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 95ea40e2e..de30c37ee 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -25,7 +25,7 @@ redprotect = "1.9.6" # Third party flow-math = "1.0.3" -paperlib = "1.0.6" +paperlib = "1.0.7" bstats = "2.2.1" serverlib = "2.3.1" paster = "1.1.1"