Scissors/patches/server/0002-UUID-validation.patch

35 lines
1.8 KiB
Diff
Raw Normal View History

2022-07-28 03:57:50 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2024-02-13 21:52:00 +00:00
From: Video <videogamesm12@gmail.com>
2023-12-10 19:12:22 +00:00
Date: Sun, 10 Dec 2023 13:11:22 -0600
Subject: [PATCH] UUID validation
2022-07-28 03:57:50 +00:00
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
2024-04-16 03:24:44 +00:00
index 9067bab8ec695417d479393f07d9bc6432427d73..433e586bed53a8c17adec74b3088899c748d4be3 100644
2022-07-28 03:57:50 +00:00
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
2023-12-10 19:12:22 +00:00
@@ -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;
2024-04-16 03:24:44 +00:00
@@ -148,7 +149,14 @@ public class HoverEvent {
2022-07-28 03:57:50 +00:00
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")));
2022-07-28 03:57:50 +00:00
- 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
2023-12-10 19:12:22 +00:00
return DataResult.success(new HoverEvent.EntityTooltipInfo(entityType, uUID, component));
2022-07-28 03:57:50 +00:00
} catch (Exception var5) {
2024-04-16 03:24:44 +00:00
return DataResult.error(() -> "Failed to parse tooltip: " + var5.getMessage());