public static void sendTitleMessages(Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut){
if(title == null){
title = "";
}
if(subtitle == null){
subtitle = "";
}
title = title.replace("&", "§");
subtitle = subtitle.replace("&", "§");
CraftPlayer craftPlayer = (CraftPlayer)player;
PacketPlayOutTitle packetTimes = new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut);
craftPlayer.getHandle().playerConnection.sendPacket(packetTimes);
IChatBaseComponent chatTitle = ChatSerializer.a("{\"text\": \"" + title + "\"}");
PacketPlayOutTitle packetTitle = new PacketPlayOutTitle(EnumTitleAction.TITLE, chatTitle);
craftPlayer.getHandle().playerConnection.sendPacket(packetTitle);
IChatBaseComponent chatSubtitle = ChatSerializer.a("{\"text\": \"" + subtitle + "\"}");
PacketPlayOutTitle packetSubtitle = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, chatSubtitle);
craftPlayer.getHandle().playerConnection.sendPacket(packetSubtitle);
}