From a8d725eb230572a971c0a4219c3d52b9d48edcfa Mon Sep 17 00:00:00 2001 From: Techcable Date: Wed, 16 Mar 2016 18:58:48 -0700 Subject: [PATCH] Don't pass null title to constructor Fixes #83 Fix resetTitle() @Zbob750 shouldn't be doing these updates in the middle of the night --- .../Player-Tab-List-and-Title-APIs.patch | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 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 e874a5060f..9af215cd6f 100644 --- a/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch @@ -100,26 +100,27 @@ 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); -+ this.sendTitle(new Title(title)); // TODO: Paper - Double check these - } - - if (subtitle != null) { +- } +- +- if (subtitle != null) { - PacketPlayOutTitle packetSubtitle = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(subtitle)[0]); - getHandle().playerConnection.sendPacket(packetSubtitle); -+ this.sendTitle(new Title(null, subtitle)); // TODO: Paper - Double check these - } +- } ++ Preconditions.checkNotNull(title, "Null title"); ++ this.sendTitle(new Title(title, subtitle)); } @Override public void resetTitle() { - PacketPlayOutTitle packetReset = new PacketPlayOutTitle(EnumTitleAction.RESET, null); - getHandle().playerConnection.sendPacket(packetReset); -+ this.hideTitle(); // TODO: Paper - Double check these ++ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.RESET, (BaseComponent[]) null, 0, 0, 0)); } @Override