Merge pull request #118 from Techcable/fix/spigot-title-compatibility

Fix backwards compatibility with spigot title api
This commit is contained in:
Zach Brown
2016-03-20 22:53:57 -05:00

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