ME1312 / VanillaCord

VanillaCord ā€“ IP Forwarding support for Vanilla Minecraft Servers
Mozilla Public License 2.0
75 stars 11 forks source link

Type Signature of Targeted Method in LoginListener has changed in 1.20.2 #22

Closed TigerWalts closed 3 months ago

TigerWalts commented 9 months ago

Using VanillaCord build 22w24b

VanillaCord 1.8
Searching versions
Downloading Minecraft Server 1.20.2
Running the self-extracting server bundle
Loading server bytecode
Found the handshake listener in alq.class
Found the login listener in alr.class
Patching classes
java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at uk.co.thinkofdeath.vanillacord.packager.BEv1.edit(BEv1.java:97)
        at uk.co.thinkofdeath.vanillacord.packager.BundleEditor.main(BundleEditor.java:59)
        at net.minecraft.bundler.Main.lambda$run$0(Main.java:54)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalStateException: Inject failed
        at uk.co.thinkofdeath.vanillacord.patcher.LoginListener$1.visitEnd(LoginListener.java:143)
        at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1518)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:744)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:424)
        at uk.co.thinkofdeath.vanillacord.patcher.Patcher.patch(Patcher.java:146)
        ... 8 more

In 1.20.2 the method now accepts a String instead of a GameProfile.

1.20.1

    protected GameProfile a(final GameProfile $$0) {
        final UUID $$ = hy.a($$0.getName());
        return new GameProfile($$, $$0.getName());
    }

1.20.2

    protected static GameProfile b(final String $$0) {
        final UUID $$ = hx.a($$0);
        return new GameProfile($$, $$0);
    }
AceFrax commented 8 months ago

Hi, have you found a fix?

TigerWalts commented 8 months ago

No. It isn't just the method above that has changed, adding a clause to patch whichever variant is in the class is the easy part.

The sticking point is that the patcher first analyses another method in the same class to discover some class or variable names for later use. The method has had a bit of a refactor so the patcher fails to retrieve what it needs.

AceFrax commented 8 months ago

Yeah, that's the reason I edited my comment. I realized that immediately when trying to patch the issue.

I'll let you know if I manage to adapt it for 1.20.2

onlyv1 commented 7 months ago

Yeah, that's the reason I edited my comment. I realized that immediately when trying to patch the issue.

I'll let you know if I manage to adapt it for 1.20.2

news?

ME1312 commented 6 months ago

So, to clear this up, here's what was going on:

VanillaCord 2.0 addresses these issues by becoming even more flexible... but still, I hope they were satisfied with their new implementation and don't make too many more major changes. šŸ˜