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
This commit is contained in:
Alex 2021-11-26 23:31:27 +01:00 committed by GitHub
parent bd9e237376
commit 11e25911d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 7 deletions

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