Merge pull request #84 from Techcable/fix/null-titles

Don't pass null title to constructor
This commit is contained in:
Zach Brown 2016-03-16 21:13:59 -05:00
commit d61ce9271e

View File

@ -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