Merge branch 'main' into major/2.0.0/1.18

This commit is contained in:
NotMyFault 2021-11-27 12:21:55 +01:00
commit 2a1bef28d0
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
6 changed files with 43 additions and 10 deletions

View File

@ -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"
@ -50,7 +50,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

View File

@ -3,7 +3,7 @@ plugins {
}
applyPaperweightAdapterConfiguration(
"1.17.1-R0.1-20211109.085555-183"
"1.17.1-R0.1-20211120.192557-194"
)
repositories {

View File

@ -0,0 +1,34 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* 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 <https://www.gnu.org/licenses/>.
*/
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;
}
}

View File

@ -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);

View File

@ -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;
}
}
}

View File

@ -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