Paper/patches/server/0443-Don-t-allow-null-UUID-s-for-chat.patch

23 lines
1.0 KiB
Diff
Raw Normal View History

2022-06-08 07:46:52 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 28 Jun 2020 19:36:55 -0400
Subject: [PATCH] Don't allow null UUID's for chat
diff --git a/src/main/java/net/minecraft/network/chat/ChatSender.java b/src/main/java/net/minecraft/network/chat/ChatSender.java
index 1710d09d115a4adceeb56e07d68d8529eb099a26..8f5ccd61a37db718f527375387b421d438471b3c 100644
--- a/src/main/java/net/minecraft/network/chat/ChatSender.java
+++ b/src/main/java/net/minecraft/network/chat/ChatSender.java
@@ -13,6 +13,11 @@ public record ChatSender(UUID uuid, Component name, @Nullable Component teamName
public ChatSender(FriendlyByteBuf buf) {
this(buf.readUUID(), buf.readComponent(), buf.readNullable(FriendlyByteBuf::readComponent));
}
+ // Paper start
+ public ChatSender {
+ com.google.common.base.Preconditions.checkNotNull(uuid, "uuid cannot be null");
+ }
+ // Paper end
public static ChatSender system(Component name) {
return new ChatSender(Util.NIL_UUID, name);