Skip to content

Commit

Permalink
Fix building UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
voruti committed Dec 1, 2023
1 parent c0f0b0c commit 8423586
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/main/java/one/oktw/Util.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package one.oktw;

import java.util.UUID;

public final class Util {
private Util() {
}


public static UUID fromString(final String input) {
return UUID.fromString(input.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.google.gson.Gson;
import com.mojang.authlib.properties.Property;
import com.mojang.util.UUIDTypeAdapter;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.NetworkState;
import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
Expand All @@ -11,6 +10,7 @@
import net.minecraft.text.LiteralTextContent;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import one.oktw.Util;
import one.oktw.interfaces.BungeeClientConnection;
import one.oktw.mixin.ClientConnectionAccessor;
import org.spongepowered.asm.mixin.Final;
Expand Down Expand Up @@ -47,7 +47,7 @@ private void onProcessHandshakeStart(HandshakeC2SPacket packet, CallbackInfo ci)


// extract forwarded profile information and save them:
((BungeeClientConnection) connection).setSpoofedUUID(UUIDTypeAdapter.fromString(split[2]));
((BungeeClientConnection) connection).setSpoofedUUID(Util.fromString(split[2]));

if (split.length == 4) {
((BungeeClientConnection) connection).setSpoofedProfile(gson.fromJson(split[3], Property[].class));
Expand Down

0 comments on commit 8423586

Please sign in to comment.