Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. public static void sendTitleAndSubTo(Player p, String title, String subtitle)
  2. {
  3. if (((CraftPlayer)p).getHandle().playerConnection.networkManager.getVersion() < 47) {
  4. return;
  5. }
  6. IChatBaseComponent chatTitle = ChatSerializer.a("{\"text\": \"" + title + "\"}");
  7. ProtocolInjector.PacketTitle t = new ProtocolInjector.PacketTitle(ProtocolInjector.PacketTitle.Action.TITLE, chatTitle);
  8. IChatBaseComponent subTitle = ChatSerializer.a("{\"text\": \"" + subtitle + "\"}");
  9. ProtocolInjector.PacketTitle sub = new ProtocolInjector.PacketTitle(ProtocolInjector.PacketTitle.Action.SUBTITLE, subTitle);
  10. ProtocolInjector.PacketTitle time = new ProtocolInjector.PacketTitle(ProtocolInjector.PacketTitle.Action.TIMES, 20, 120, 20);
  11. ((CraftPlayer)p).getHandle().playerConnection.sendPacket(time);
  12. ((CraftPlayer)p).getHandle().playerConnection.sendPacket(t);
  13. ((CraftPlayer)p).getHandle().playerConnection.sendPacket(sub);
  14. }
  15.  
  16. public static void sendTitleTo(Player p, String title)
  17. {
  18. if (((CraftPlayer)p).getHandle().playerConnection.networkManager.getVersion() < 47) {
  19. return;
  20. }
  21. IChatBaseComponent chatTitle = ChatSerializer.a("{\"text\": \"" + title + "\"}");
  22. ProtocolInjector.PacketTitle t = new ProtocolInjector.PacketTitle(ProtocolInjector.PacketTitle.Action.TITLE, chatTitle);
  23. ProtocolInjector.PacketTitle time = new ProtocolInjector.PacketTitle(ProtocolInjector.PacketTitle.Action.TIMES, 20, 120, 20);
  24. ((CraftPlayer)p).getHandle().playerConnection.sendPacket(time);
  25. ((CraftPlayer)p).getHandle().playerConnection.sendPacket(t);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement