From a2c103c6a170538f96b8a69464066864a8830d82 Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Sun, 9 Apr 2023 20:04:25 -0300 Subject: [PATCH] fixed uuid for console --- .../com/viaversion/fabric/mc114/commands/NMSCommandSender.java | 3 ++- .../com/viaversion/fabric/mc115/commands/NMSCommandSender.java | 3 ++- .../com/viaversion/fabric/mc116/commands/NMSCommandSender.java | 3 ++- .../com/viaversion/fabric/mc117/commands/NMSCommandSender.java | 3 ++- .../com/viaversion/fabric/mc118/commands/NMSCommandSender.java | 3 ++- .../com/viaversion/fabric/mc119/commands/NMSCommandSender.java | 3 ++- .../com/viaversion/fabric/mc120/commands/NMSCommandSender.java | 3 ++- .../com/viaversion/fabric/mc18/commands/NMSCommandSender.java | 3 ++- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/viafabric-mc114/src/main/java/com/viaversion/fabric/mc114/commands/NMSCommandSender.java b/viafabric-mc114/src/main/java/com/viaversion/fabric/mc114/commands/NMSCommandSender.java index c214d0c..e3236b1 100644 --- a/viafabric-mc114/src/main/java/com/viaversion/fabric/mc114/commands/NMSCommandSender.java +++ b/viafabric-mc114/src/main/java/com/viaversion/fabric/mc114/commands/NMSCommandSender.java @@ -11,6 +11,7 @@ import net.minecraft.server.command.CommandSource; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.text.Text; +import java.nio.charset.StandardCharsets; import java.util.UUID; public class NMSCommandSender implements ViaCommandSender { @@ -49,7 +50,7 @@ public class NMSCommandSender implements ViaCommandSender { && source instanceof ClientCommandSource) { return MinecraftClient.getInstance().player.getUuid(); } - return UUID.fromString(getName()); + return UUID.nameUUIDFromBytes(getName().getBytes(StandardCharsets.UTF_8)); } @Override diff --git a/viafabric-mc115/src/main/java/com/viaversion/fabric/mc115/commands/NMSCommandSender.java b/viafabric-mc115/src/main/java/com/viaversion/fabric/mc115/commands/NMSCommandSender.java index c21ec0c..cf4bb99 100644 --- a/viafabric-mc115/src/main/java/com/viaversion/fabric/mc115/commands/NMSCommandSender.java +++ b/viafabric-mc115/src/main/java/com/viaversion/fabric/mc115/commands/NMSCommandSender.java @@ -11,6 +11,7 @@ import net.minecraft.server.command.CommandSource; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.text.Text; +import java.nio.charset.StandardCharsets; import java.util.UUID; public class NMSCommandSender implements ViaCommandSender { @@ -47,7 +48,7 @@ public class NMSCommandSender implements ViaCommandSender { } else if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT && source instanceof ClientCommandSource) { return MinecraftClient.getInstance().player.getUuid(); } - return UUID.fromString(getName()); + return UUID.nameUUIDFromBytes(getName().getBytes(StandardCharsets.UTF_8)); } @Override diff --git a/viafabric-mc116/src/main/java/com/viaversion/fabric/mc116/commands/NMSCommandSender.java b/viafabric-mc116/src/main/java/com/viaversion/fabric/mc116/commands/NMSCommandSender.java index c39c628..1b34015 100644 --- a/viafabric-mc116/src/main/java/com/viaversion/fabric/mc116/commands/NMSCommandSender.java +++ b/viafabric-mc116/src/main/java/com/viaversion/fabric/mc116/commands/NMSCommandSender.java @@ -8,6 +8,7 @@ import net.minecraft.entity.Entity; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.text.Text; +import java.nio.charset.StandardCharsets; import java.util.UUID; public class NMSCommandSender implements ViaCommandSender { @@ -44,7 +45,7 @@ public class NMSCommandSender implements ViaCommandSender { } else if (source instanceof FabricClientCommandSource) { return ((FabricClientCommandSource) source).getPlayer().getUuid(); } - return UUID.fromString(getName()); + return UUID.nameUUIDFromBytes(getName().getBytes(StandardCharsets.UTF_8)); } @Override diff --git a/viafabric-mc117/src/main/java/com/viaversion/fabric/mc117/commands/NMSCommandSender.java b/viafabric-mc117/src/main/java/com/viaversion/fabric/mc117/commands/NMSCommandSender.java index 9ede2a5..e89d794 100644 --- a/viafabric-mc117/src/main/java/com/viaversion/fabric/mc117/commands/NMSCommandSender.java +++ b/viafabric-mc117/src/main/java/com/viaversion/fabric/mc117/commands/NMSCommandSender.java @@ -9,6 +9,7 @@ import net.minecraft.text.MutableText; import net.minecraft.text.Text; import com.viaversion.viaversion.api.command.ViaCommandSender; +import java.nio.charset.StandardCharsets; import java.util.UUID; public class NMSCommandSender implements ViaCommandSender { @@ -45,7 +46,7 @@ public class NMSCommandSender implements ViaCommandSender { } else if (source instanceof FabricClientCommandSource) { return ((FabricClientCommandSource) source).getPlayer().getUuid(); } - return UUID.fromString(getName()); + return UUID.nameUUIDFromBytes(getName().getBytes(StandardCharsets.UTF_8)); } @Override diff --git a/viafabric-mc118/src/main/java/com/viaversion/fabric/mc118/commands/NMSCommandSender.java b/viafabric-mc118/src/main/java/com/viaversion/fabric/mc118/commands/NMSCommandSender.java index 97f2ad8..d69edb9 100644 --- a/viafabric-mc118/src/main/java/com/viaversion/fabric/mc118/commands/NMSCommandSender.java +++ b/viafabric-mc118/src/main/java/com/viaversion/fabric/mc118/commands/NMSCommandSender.java @@ -8,6 +8,7 @@ import net.minecraft.server.command.ServerCommandSource; import net.minecraft.text.Text; import com.viaversion.viaversion.api.command.ViaCommandSender; +import java.nio.charset.StandardCharsets; import java.util.UUID; public class NMSCommandSender implements ViaCommandSender { @@ -44,7 +45,7 @@ public class NMSCommandSender implements ViaCommandSender { } else if (source instanceof FabricClientCommandSource) { return ((FabricClientCommandSource) source).getPlayer().getUuid(); } - return UUID.fromString(getName()); + return UUID.nameUUIDFromBytes(getName().getBytes(StandardCharsets.UTF_8)); } @Override diff --git a/viafabric-mc119/src/main/java/com/viaversion/fabric/mc119/commands/NMSCommandSender.java b/viafabric-mc119/src/main/java/com/viaversion/fabric/mc119/commands/NMSCommandSender.java index d30bb21..2961f49 100644 --- a/viafabric-mc119/src/main/java/com/viaversion/fabric/mc119/commands/NMSCommandSender.java +++ b/viafabric-mc119/src/main/java/com/viaversion/fabric/mc119/commands/NMSCommandSender.java @@ -9,6 +9,7 @@ import net.minecraft.text.MutableText; import net.minecraft.text.Text; import com.viaversion.viaversion.api.command.ViaCommandSender; +import java.nio.charset.StandardCharsets; import java.util.UUID; public class NMSCommandSender implements ViaCommandSender { @@ -45,7 +46,7 @@ public class NMSCommandSender implements ViaCommandSender { } else if (source instanceof FabricClientCommandSource) { return ((FabricClientCommandSource) source).getPlayer().getUuid(); } - return UUID.fromString(getName()); + return UUID.nameUUIDFromBytes(getName().getBytes(StandardCharsets.UTF_8)); } @Override diff --git a/viafabric-mc120/src/main/java/com/viaversion/fabric/mc120/commands/NMSCommandSender.java b/viafabric-mc120/src/main/java/com/viaversion/fabric/mc120/commands/NMSCommandSender.java index 094443a..bc7f5e7 100644 --- a/viafabric-mc120/src/main/java/com/viaversion/fabric/mc120/commands/NMSCommandSender.java +++ b/viafabric-mc120/src/main/java/com/viaversion/fabric/mc120/commands/NMSCommandSender.java @@ -9,6 +9,7 @@ import net.minecraft.text.MutableText; import net.minecraft.text.Text; import com.viaversion.viaversion.api.command.ViaCommandSender; +import java.nio.charset.StandardCharsets; import java.util.UUID; public class NMSCommandSender implements ViaCommandSender { @@ -45,7 +46,7 @@ public class NMSCommandSender implements ViaCommandSender { } else if (source instanceof FabricClientCommandSource) { return ((FabricClientCommandSource) source).getPlayer().getUuid(); } - return UUID.fromString(getName()); + return UUID.nameUUIDFromBytes(getName().getBytes(StandardCharsets.UTF_8)); } @Override diff --git a/viafabric-mc18/src/main/java/com/viaversion/fabric/mc18/commands/NMSCommandSender.java b/viafabric-mc18/src/main/java/com/viaversion/fabric/mc18/commands/NMSCommandSender.java index 5178cb1..7073bb5 100644 --- a/viafabric-mc18/src/main/java/com/viaversion/fabric/mc18/commands/NMSCommandSender.java +++ b/viafabric-mc18/src/main/java/com/viaversion/fabric/mc18/commands/NMSCommandSender.java @@ -6,6 +6,7 @@ import net.minecraft.command.CommandSource; import net.minecraft.entity.Entity; import net.minecraft.text.Text; +import java.nio.charset.StandardCharsets; import java.util.UUID; public class NMSCommandSender implements ViaCommandSender { @@ -31,7 +32,7 @@ public class NMSCommandSender implements ViaCommandSender { if (source instanceof Entity) { return ((Entity) source).getUuid(); } - return UUID.fromString(getName()); + return UUID.nameUUIDFromBytes(getName().getBytes(StandardCharsets.UTF_8)); } @Override