mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-10-31 20:27:10 +00:00
52 lines
2.6 KiB
Diff
52 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Telesphoreo <me@telesphoreo.me>
|
|
Date: Sun, 10 Dec 2023 13:11:22 -0600
|
|
Subject: [PATCH] UUID validation
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
index b65dcff9812dbc3256c080ac264c4aafd83ce276..82b53a7bfb37bfa1752a016a8a454c0b994b9108 100644
|
|
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
@@ -74,7 +74,11 @@ public final class NbtUtils {
|
|
UUID uUID = nbt.hasUUID("Id") ? nbt.getUUID("Id") : Util.NIL_UUID;
|
|
// Paper start - support string UUID's
|
|
if (nbt.contains("Id", Tag.TAG_STRING)) {
|
|
- uUID = UUID.fromString(nbt.getString("Id"));
|
|
+ // Scissors start - Validate String UUIDs in game profiles
|
|
+ try {
|
|
+ uUID = UUID.fromString(nbt.getString("Id"));
|
|
+ } catch (Exception ignored) {}
|
|
+ // Scissors end
|
|
}
|
|
// Paper end
|
|
String string = nbt.getString("Name");
|
|
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
index 7fd85ae2ebd7225f06d874aa7e37fbdb89e3ea92..b2cc15da40aa7bbcfc234b4e147ed0e53f359efa 100644
|
|
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
@@ -20,6 +20,7 @@ import net.minecraft.nbt.CompoundTag;
|
|
import net.minecraft.nbt.TagParser;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
import net.minecraft.util.ExtraCodecs;
|
|
+import net.minecraft.util.GsonHelper;
|
|
import net.minecraft.util.StringRepresentable;
|
|
import net.minecraft.world.entity.EntityType;
|
|
import net.minecraft.world.item.Item;
|
|
@@ -161,7 +162,14 @@ public class HoverEvent {
|
|
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
|
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
|
|
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
|
- UUID uUID = UUID.fromString(compoundTag.getString("id"));
|
|
+ // Scissors start
|
|
+ UUID uUID;
|
|
+ try {
|
|
+ uUID = UUID.fromString(compoundTag.getString("id"));
|
|
+ } catch (Exception ex) {
|
|
+ return null;
|
|
+ }
|
|
+ // Scissors end
|
|
return DataResult.success(new HoverEvent.EntityTooltipInfo(entityType, uUID, component));
|
|
} catch (Exception var5) {
|
|
return DataResult.error(() -> {
|