2021-06-12 09:24:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Tue, 27 Dec 2016 15:02:42 -0500
|
|
|
|
Subject: [PATCH] String based Action Bar API
|
|
|
|
|
|
|
|
|
2021-06-16 01:41:38 +02:00
|
|
|
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);
|
2021-06-12 09:24:28 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2023-06-21 15:36:14 +02:00
|
|
|
index 54fbc06216e1eec6976d6514d343345ee17b020c..a27d36b8dbdcec1ac2139fd7ab11ba7184b7d35c 100644
|
2021-06-12 09:24:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2023-06-16 12:28:31 +02:00
|
|
|
@@ -332,6 +332,29 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2021-06-12 09:24:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Paper start
|
|
|
|
+ @Override
|
2023-04-02 20:53:29 +02:00
|
|
|
+ @Deprecated
|
2021-06-12 09:24:28 +02:00
|
|
|
+ public void sendActionBar(BaseComponent[] message) {
|
|
|
|
+ if (getHandle().connection == null) return;
|
2021-06-16 01:41:38 +02:00
|
|
|
+ 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);
|
2021-06-12 09:24:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
2023-04-02 20:53:29 +02:00
|
|
|
+ @Deprecated
|
2021-06-12 09:24:28 +02:00
|
|
|
+ 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
|
2023-04-02 20:53:29 +02:00
|
|
|
+ @Deprecated
|
2021-06-12 09:24:28 +02:00
|
|
|
+ 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) {
|