From 7db19cb346591da2252c0b0cb2e2b09d0567b56d Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 22 Jul 2020 10:01:35 +0200 Subject: [PATCH] Use title packet for actionbar methods (#3959) --- Spigot-API-Patches/Add-String-based-Action-Bar-API.patch | 7 +++++++ Spigot-Server-Patches/String-based-Action-Bar-API.patch | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Spigot-API-Patches/Add-String-based-Action-Bar-API.patch b/Spigot-API-Patches/Add-String-based-Action-Bar-API.patch index 23e4bdde6..41b11c8f7 100644 --- a/Spigot-API-Patches/Add-String-based-Action-Bar-API.patch +++ b/Spigot-API-Patches/Add-String-based-Action-Bar-API.patch @@ -31,6 +31,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param message The message to send + */ + public void sendActionBar(char alternateChar, @NotNull String message); ++ ++ /** ++ * Sends an Action Bar message to the client. ++ * ++ * @param message The components to send ++ */ ++ public void sendActionBar(@NotNull net.md_5.bungee.api.chat.BaseComponent... message); + /** * Sends the component to the player diff --git a/Spigot-Server-Patches/String-based-Action-Bar-API.patch b/Spigot-Server-Patches/String-based-Action-Bar-API.patch index 20a8e6b31..3f64b24f7 100644 --- a/Spigot-Server-Patches/String-based-Action-Bar-API.patch +++ b/Spigot-Server-Patches/String-based-Action-Bar-API.patch @@ -26,9 +26,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper start + @Override ++ public void sendActionBar(BaseComponent[] message) { ++ if (getHandle().playerConnection == null) return; ++ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.ACTIONBAR, message, -1, -1, -1)); ++ } ++ ++ @Override + public void sendActionBar(String message) { + if (getHandle().playerConnection == null || message == null || message.isEmpty()) return; -+ getHandle().playerConnection.sendPacket(new PacketPlayOutChat(new net.minecraft.server.ChatComponentText(message), net.minecraft.server.ChatMessageType.GAME_INFO, SystemUtils.getNullUUID())); ++ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(message))); + } + + @Override