Guest User

Sending Title and Subtitle

a guest
Jan 14th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. public static void sendTitle(Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut) {
  2.     PacketPlayOutTitle aTitle = new PacketPlayOutTitle(EnumTitleAction.TITLE, ChatSerializer.a(ChatColor.translateAlternateColorCodes('&', "{\"text\": \"" + title + "\"}")), fadeIn, stay, fadeOut);
  3.     PacketPlayOutTitle aSubtitle = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, ChatSerializer.a(ChatColor.translateAlternateColorCodes('&', "{\"text\": \"" + subtitle + "\"}")), fadeIn, stay, fadeOut);
  4.     ((CraftPlayer) player).getHandle().getConnection().sendPacket(aTitle);
  5.     ((CraftPlayer) player).getHandle().getConnection().sendPacket(aSubtitle);
  6. }
Advertisement
Add Comment
Please, Sign In to add comment