diff options
author | Spottedleaf <[email protected]> | 2022-09-01 09:51:59 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2022-09-01 09:51:59 -0700 |
commit | 046466f3ba72d6bdaa0213cde64676dd0024ace0 (patch) | |
tree | 717d69c8521cac0e4881c009e636891e116c2378 /patches/server/0126-String-based-Action-Bar-API.patch | |
parent | eff22eb0541559f05cf9a8c370d70c3b346f80f6 (diff) | |
download | Paper-046466f3ba72d6bdaa0213cde64676dd0024ace0.tar.gz Paper-046466f3ba72d6bdaa0213cde64676dd0024ace0.zip |
Re-arrange most chunk system patches to front (#8338)
* Re-arrange most chunk system patches to front
Co-authored-by: Spottedleaf <[email protected]>
Diffstat (limited to 'patches/server/0126-String-based-Action-Bar-API.patch')
-rw-r--r-- | patches/server/0126-String-based-Action-Bar-API.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/patches/server/0126-String-based-Action-Bar-API.patch b/patches/server/0126-String-based-Action-Bar-API.patch new file mode 100644 index 0000000000..993e5b8cbd --- /dev/null +++ b/patches/server/0126-String-based-Action-Bar-API.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Tue, 27 Dec 2016 15:02:42 -0500 +Subject: [PATCH] String based Action Bar API + + +diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java +index 32ef3edebe94a2014168b7e438752a80b2687e5f..ab6c58eed6707ab7b0aa3e7549a871ad7dfad87f 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java +@@ -7,6 +7,7 @@ import net.minecraft.network.protocol.Packet; + public class ClientboundSetActionBarTextPacket implements Packet<ClientGamePacketListener> { + private final Component text; + public net.kyori.adventure.text.Component adventure$text; // Paper ++ public net.md_5.bungee.api.chat.BaseComponent[] components; // Paper + + public ClientboundSetActionBarTextPacket(Component message) { + this.text = message; +@@ -21,6 +22,8 @@ public class ClientboundSetActionBarTextPacket implements Packet<ClientGamePacke + // Paper start + if (this.adventure$text != null) { + buf.writeComponent(this.adventure$text); ++ } else if (this.components != null) { ++ buf.writeComponent(this.components); + } else + // Paper end + buf.writeComponent(this.text); +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index da91150f7462c2743d7394b148ddb52e9af8b797..a5418b1c78e1f1eb9f552450367717fee9487193 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -274,6 +274,26 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + + // Paper start ++ @Override ++ public void sendActionBar(BaseComponent[] message) { ++ if (getHandle().connection == null) return; ++ net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket packet = new net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket((net.minecraft.network.chat.Component) null); ++ packet.components = message; ++ getHandle().connection.send(packet); ++ } ++ ++ @Override ++ public void sendActionBar(String message) { ++ if (getHandle().connection == null || message == null || message.isEmpty()) return; ++ getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket(CraftChatMessage.fromStringOrNull(message))); ++ } ++ ++ @Override ++ public void sendActionBar(char alternateChar, String message) { ++ if (message == null || message.isEmpty()) return; ++ sendActionBar(org.bukkit.ChatColor.translateAlternateColorCodes(alternateChar, message)); ++ } ++ + @Override + public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) { + if (header != null) { |