SPIGOT-1036: Add API to manipulate sendTitle timings.

This commit is contained in:
md_5 2016-12-16 09:48:14 +11:00
parent 655d8407ce
commit 0a6a5cb4ad

View File

@ -1364,6 +1364,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void sendTitle(String title, String subtitle) { public void sendTitle(String title, String subtitle) {
sendTitle(title, subtitle, 10, 70, 20);
}
@Override
public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
if (title != null) { if (title != null) {
PacketPlayOutTitle packetTitle = new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(title)[0]); PacketPlayOutTitle packetTitle = new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(title)[0]);
getHandle().playerConnection.sendPacket(packetTitle); getHandle().playerConnection.sendPacket(packetTitle);
@ -1373,6 +1378,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
PacketPlayOutTitle packetSubtitle = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(subtitle)[0]); PacketPlayOutTitle packetSubtitle = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(subtitle)[0]);
getHandle().playerConnection.sendPacket(packetSubtitle); getHandle().playerConnection.sendPacket(packetSubtitle);
} }
PacketPlayOutTitle times = new PacketPlayOutTitle(fadeIn, stay, fadeOut);
getHandle().playerConnection.sendPacket(times);
} }
@Override @Override