Validate ResourceLocation in NBT reading

This commit is contained in:
Nassim Jahnke
2024-01-04 13:52:38 +01:00
parent 01a7a72224
commit 0f3d126ce1
2 changed files with 68 additions and 3 deletions

View File

@@ -53,11 +53,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Nullable
public static GameProfile readGameProfile(CompoundTag nbt) {
UUID uUID = nbt.hasUUID("Id") ? nbt.getUUID("Id") : Util.NIL_UUID;
+ // Paper start - support string UUID's
+ // Paper start - Support string UUIDs
+ if (nbt.contains("Id", Tag.TAG_STRING)) {
+ uUID = UUID.fromString(nbt.getString("Id"));
+ try {
+ uUID = UUID.fromString(nbt.getString("Id"));
+ } catch (IllegalArgumentException ignored){
+ }
+ }
+ // Paper end
+ // Paper end - Support string UUIDs
String string = nbt.getString("Name");
try {