Don't pass null title to constructor

Fixes #83
Fix resetTitle()
@Zbob750 shouldn't be doing these updates in the middle of the night
This commit is contained in:
Techcable 2016-03-16 18:58:48 -07:00
parent 59ca434484
commit a8d725eb23

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