From acad27e9e76cfc26472d728915b610dd1ab6ea44 Mon Sep 17 00:00:00 2001 From: Techcable Date: Sun, 20 Mar 2016 20:45:13 -0700 Subject: [PATCH] Fix backwards compatibility with spigot title api I shouldn't have assumed their api was anything other but a thin (and incomplete) wrapper over the packets. Fixes #94 --- .../Player-Tab-List-and-Title-APIs.patch | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch index 9af215cd6..2ce8fbe2d 100644 --- a/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch @@ -100,30 +100,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - @Override public void sendTitle(String title, String subtitle) { -- if (title != null) { + if (title != null) { - PacketPlayOutTitle packetTitle = new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(title)[0]); -- getHandle().playerConnection.sendPacket(packetTitle); -- } -- -- if (subtitle != null) { ++ PacketPlayOutTitle packetTitle = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, CraftChatMessage.fromString(title)[0]); + getHandle().playerConnection.sendPacket(packetTitle); + } + + if (subtitle != null) { - PacketPlayOutTitle packetSubtitle = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(subtitle)[0]); -- getHandle().playerConnection.sendPacket(packetSubtitle); -- } -+ Preconditions.checkNotNull(title, "Null title"); -+ this.sendTitle(new Title(title, subtitle)); ++ PacketPlayOutTitle packetSubtitle = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(subtitle)[0]); + getHandle().playerConnection.sendPacket(packetSubtitle); + } } @Override public void resetTitle() { - PacketPlayOutTitle packetReset = new PacketPlayOutTitle(EnumTitleAction.RESET, null); -- getHandle().playerConnection.sendPacket(packetReset); -+ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.RESET, (BaseComponent[]) null, 0, 0, 0)); ++ PacketPlayOutTitle packetReset = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.RESET, null); + getHandle().playerConnection.sendPacket(packetReset); } - @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java