From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 27 Dec 2016 15:02:42 -0500 Subject: [PATCH] String based Action Bar API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 764a8ef952b6f3a38ae8430c0648ad1694aa89b9..d349f0c87bfad19cf0bddb4709f1d7b0dd4b4a36 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -216,6 +216,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } // Paper start + @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)); + } + + @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) {