Revert "Add classloader exclusion to launchwrapper (#68)"

This reverts commit 2ac95074a6.
This commit is contained in:
yushijinhun 2020-04-29 23:34:12 +08:00
parent d3fa2a77eb
commit 106e13b17f
No known key found for this signature in database
GPG key ID: 5BC167F73EA558E4
2 changed files with 0 additions and 74 deletions

View file

@ -60,7 +60,6 @@ import moe.yushi.authlibinjector.transform.DumpClassListener;
import moe.yushi.authlibinjector.transform.support.AuthlibLogInterceptor;
import moe.yushi.authlibinjector.transform.support.CitizensTransformer;
import moe.yushi.authlibinjector.transform.support.ConstantURLTransformUnit;
import moe.yushi.authlibinjector.transform.support.LaunchwrapperExclusionTransformer;
import moe.yushi.authlibinjector.transform.support.MC52974Workaround;
import moe.yushi.authlibinjector.transform.support.MC52974_1710Workaround;
import moe.yushi.authlibinjector.transform.support.MainArgumentsTransformer;
@ -450,7 +449,6 @@ public final class AuthlibInjector {
transformer.units.add(new AuthlibLogInterceptor());
}
transformer.units.add(new LaunchwrapperExclusionTransformer());
transformer.units.add(new MainArgumentsTransformer());
transformer.units.add(new ConstantURLTransformUnit(urlProcessor));
transformer.units.add(new CitizensTransformer());

View file

@ -1,72 +0,0 @@
/*
* Copyright (C) 2020 Haowei Wen <yushijinhun@gmail.com> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package moe.yushi.authlibinjector.transform.support;
import static org.objectweb.asm.Opcodes.ALOAD;
import static org.objectweb.asm.Opcodes.ASM7;
import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
import java.util.Optional;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import moe.yushi.authlibinjector.transform.TransformContext;
import moe.yushi.authlibinjector.transform.TransformUnit;
public class LaunchwrapperExclusionTransformer implements TransformUnit {
@Override
public Optional<ClassVisitor> transform(ClassLoader classLoader, String className, ClassVisitor writer, TransformContext context) {
if ("net.minecraft.launchwrapper.LaunchClassLoader".equals(className)) {
return Optional.of(new ClassVisitor(ASM7, writer) {
@Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
if ("<init>".equals(name)) {
return new MethodVisitor(ASM7, super.visitMethod(access, name, descriptor, signature, exceptions)) {
boolean exclusionAdded = false;
@Override
public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) {
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
if (!exclusionAdded &&
opcode == INVOKEVIRTUAL &&
"net/minecraft/launchwrapper/LaunchClassLoader".equals(owner) &&
"addClassLoaderExclusion".equals(name) &&
"(Ljava/lang/String;)V".equals(descriptor)) {
super.visitVarInsn(ALOAD, 0);
super.visitLdcInsn("moe.yushi.authlibinjector.");
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
exclusionAdded = true;
context.markModified();
}
}
};
}
return super.visitMethod(access, name, descriptor, signature, exceptions);
}
});
} else {
return Optional.empty();
}
}
@Override
public String toString() {
return "Launchwrapper ClassLoader Exclusion";
}
}