mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 21:31:25 +01:00
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:
parent
372152df9d
commit
acad27e9e7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user