From cdbbedb66253885c813d1f662ef0fb65679ce4a4 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Mon, 13 Sep 2021 10:42:36 +0200 Subject: [PATCH] Update Upstream 6008fe7 Remove class shutter --- .../MinecraftHidingClassShutter.java | 38 ------------------- .../scripting/RhinoCraftScriptEngine.java | 9 ++--- 2 files changed, 4 insertions(+), 43 deletions(-) delete mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/scripting/MinecraftHidingClassShutter.java 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 deleted file mode 100644 index 2357f0036..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/scripting/MinecraftHidingClassShutter.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 & 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"); - } - -} 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 360123977..5326317ef 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 @@ -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);