From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Tue, 29 Jun 2021 21:37:40 -0500
Subject: [PATCH] Component related conveniences


diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 52a81eaac0a080738fc2d12b30693ad161066d77..6d25b3397a45d77b96d04a5b099d58a092d43177 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1680,6 +1680,26 @@ public class ServerPlayer extends Player {
     }
     // CraftBukkit end
 
+    // Purpur start
+    public void sendActionBarMessage(@Nullable String message) {
+        if (message != null) {
+            sendActionBarMessage(net.kyori.adventure.text.minimessage.MiniMessage.get().parse(message));
+        }
+    }
+
+    public void sendActionBarMessage(@Nullable net.kyori.adventure.text.Component message) {
+        if (message != null) {
+            sendActionBarMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message));
+        }
+    }
+
+    public void sendActionBarMessage(@Nullable Component message) {
+        if (message != null) {
+            displayClientMessage(message, true);
+        }
+    }
+    // Purpur end
+
     @Override
     public void displayClientMessage(Component message, boolean actionBar) {
         this.sendMessage(message, actionBar ? ChatType.GAME_INFO : ChatType.CHAT, Util.NIL_UUID);
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index ea8956b2c4cbe7059512ebfa9fd7a865e5fae0ac..1bbb3f0658628ec36cd9e177df3acc07ef107428 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1396,6 +1396,62 @@ public abstract class PlayerList {
     }
     // CraftBukkit end
 
+    // Purpur start
+    public void broadcast(@Nullable String message) {
+        broadcast(message, Util.NIL_UUID);
+    }
+
+    public void broadcast(@Nullable String message, ChatType type) {
+        broadcast(message, type, Util.NIL_UUID);
+    }
+
+    public void broadcast(@Nullable String message, UUID sender) {
+        broadcast(message, ChatType.SYSTEM, sender);
+    }
+
+    public void broadcast(@Nullable String message, ChatType type, UUID sender) {
+        if (message != null) {
+            broadcast(net.kyori.adventure.text.minimessage.MiniMessage.get().parse(message), type, sender);
+        }
+    }
+
+    public void broadcast(@Nullable net.kyori.adventure.text.Component message) {
+        broadcast(message, Util.NIL_UUID);
+    }
+
+    public void broadcast(@Nullable net.kyori.adventure.text.Component message, ChatType type) {
+        broadcast(message, type, Util.NIL_UUID);
+    }
+
+    public void broadcast(@Nullable net.kyori.adventure.text.Component message, UUID sender) {
+        broadcast(message, ChatType.SYSTEM, sender);
+    }
+
+    public void broadcast(@Nullable net.kyori.adventure.text.Component message, ChatType type, UUID sender) {
+        if (message != null) {
+            broadcast(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), type, sender);
+        }
+    }
+
+    public void broadcast(@Nullable Component message) {
+        broadcast(message, Util.NIL_UUID);
+    }
+
+    public void broadcast(@Nullable Component message, ChatType type) {
+        broadcast(message, type, Util.NIL_UUID);
+    }
+
+    public void broadcast(@Nullable Component message, UUID sender) {
+        broadcast(message, ChatType.SYSTEM, sender);
+    }
+
+    public void broadcast(@Nullable Component message, ChatType type, UUID sender) {
+        if (message != null) {
+            broadcastMessage(message, type, sender);
+        }
+    }
+    // Purpur end
+
     public void broadcastMessage(Component message, ChatType type, UUID sender) {
         this.server.sendMessage(message, sender);
         Iterator iterator = this.players.iterator();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index da01861990da0307cfba14cb2492baf7761a3930..b2ccdd8f687e3bf0dc64110259a301e879bd3657 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3589,6 +3589,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
         return SlotAccess.NULL;
     }
 
+    // Purpur Start
+    public void sendMessage(@Nullable String message) {
+        sendMessage(message, Util.NIL_UUID);
+    }
+
+    public void sendMessage(@Nullable String message, UUID sender) {
+        if (message != null) {
+            sendMessage(net.kyori.adventure.text.minimessage.MiniMessage.get().parse(message), sender);
+        }
+    }
+
+    public void sendMessage(@Nullable net.kyori.adventure.text.Component message) {
+        sendMessage(message, Util.NIL_UUID);
+    }
+
+    public void sendMessage(@Nullable net.kyori.adventure.text.Component message, UUID sender) {
+        if (message != null) {
+            sendMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), sender);
+        }
+    }
+
+    public void sendMessage(@Nullable Component message) {
+        if (message != null) {
+            sendMessage(message, Util.NIL_UUID);
+        }
+    }
+    // Purpur end
+
     @Override
     public void sendMessage(Component message, UUID sender) {}
 
