Update Upstream

6008fe7 Remove class shutter
This commit is contained in:
NotMyFault 2021-09-13 10:42:36 +02:00
parent 5d31b7034d
commit cdbbedb662
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 4 additions and 43 deletions

View File

@ -1,38 +0,0 @@
/*
* 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 & de-obfuscated names from scripts.
*/
class MinecraftHidingClassShutter implements ClassShutter {
@Override
public boolean visibleToScripts(String fullClassName) {
if (!fullClassName.contains(".")) {
// Default package -- probably Minecraft
return false;
}
return !fullClassName.startsWith("net.minecraft");
}
}

View File

@ -36,13 +36,13 @@ public class RhinoCraftScriptEngine implements CraftScriptEngine {
private int timeLimit;
@Override
public void setTimeLimit(int milliseconds) {
timeLimit = milliseconds;
public int getTimeLimit() {
return timeLimit;
}
@Override
public int getTimeLimit() {
return timeLimit;
public void setTimeLimit(int milliseconds) {
timeLimit = milliseconds;
}
@Override
@ -50,7 +50,6 @@ 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);