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
This commit is contained in:
Techcable 2016-03-20 20:45:13 -07:00
parent 372152df9d
commit acad27e9e7

View File

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