fixed uuid for console

This commit is contained in:
creeper123123321 2023-04-09 20:04:25 -03:00
parent e3fb5db561
commit a2c103c6a1
8 changed files with 16 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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