Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. public static void sendTitle(CommandSender cs, String text) {
  2.  
  3. IChatBaseComponent chatTitle = IChatBaseComponent.ChatSerializer
  4. .a("{\"text\": \"" + text + "\",color:" + ChatColor.GOLD.name().toLowerCase() + "}");
  5.  
  6. PacketPlayOutTitle title = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, chatTitle);
  7. PacketPlayOutTitle length = new PacketPlayOutTitle(5, 20, 5);
  8.  
  9. ((CraftPlayer) cs).getHandle().playerConnection.sendPacket(title);
  10. ((CraftPlayer) cs).getHandle().playerConnection.sendPacket(length);
  11. }
  12.  
  13. public static void sendSubTitle(Player player, String text) {
  14.  
  15. IChatBaseComponent chatTitle = IChatBaseComponent.ChatSerializer
  16. .a("{\"text\": \"" + text + "\",color:" + ChatColor.GOLD.name().toLowerCase() + "}");
  17.  
  18. PacketPlayOutTitle title = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, chatTitle);
  19. PacketPlayOutTitle length = new PacketPlayOutTitle(5, 20, 5);
  20.  
  21. ((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
  22. ((CraftPlayer) player).getHandle().playerConnection.sendPacket(length);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement