Guest User

Funktion Title

a guest
May 29th, 2016
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. public static void sendTitle(Player p, String title, String subtitle) {
  2.         /**
  3.          * @auuthor CytoPlays
  4.          * 1.8 Funktion
  5.          * Titles
  6.          */
  7.         String title_text = title;
  8.         String subtitle_text = subtitle;
  9.        
  10.         CraftPlayer cp = (CraftPlayer) p;
  11.         PlayerConnection con = cp.getHandle().playerConnection;
  12.        
  13.        
  14.         String title_json = ("{text:\"" + title_text + "\"}");
  15.         String subtitle_json= ("{text:\"" + subtitle_text + "\"}");
  16.        
  17.         IChatBaseComponent comp_title = ChatSerializer.a(title_json);
  18.         IChatBaseComponent comp_subtitle = ChatSerializer.a(subtitle_json);
  19.        
  20.         PacketPlayOutTitle packet_title = new PacketPlayOutTitle(EnumTitleAction.TITLE, comp_title);
  21.         PacketPlayOutTitle packet_subtitle = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, comp_subtitle);
  22.        
  23.         con.sendPacket(packet_title);
  24.         con.sendPacket(packet_subtitle);
  25.     }
Add Comment
Please, Sign In to add comment