Created
February 19, 2015 09:04
-
-
Save NeatMonster/05a0a67e1f1c0060b4c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void sendTitle(Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut) { | |
CraftPlayer craftplayer = (CraftPlayer)player; | |
PlayerConnection connection = craftplayer.getHandle().playerConnection; | |
IChatBaseComponent titleJSON = ChatSerializer.a("{'text': '" + ChatColor.translateAlternateColorCodes('&', title) + "'}"); | |
IChatBaseComponent subtitleJSON = ChatSerializer.a("{'text': '" + ChatColor.translateAlternateColorCodes('&', subtitle) + "'}"); | |
Packet length = new PacketPlayOutTitle(EnumTitleAction.TIMES, titleJSON, fadeIn, stay, fadeOut); | |
Packet titlePacket = new PacketPlayOutTitle(EnumTitleAction.TITLE, titleJSON, fadeIn, stay, fadeOut); | |
Packet subtitlePacket = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, subtitleJSON, fadeIn, stay, fadeOut); | |
connection.sendPacket(titlePacket); | |
connection.sendPacket(length); | |
connection.sendPacket(subtitlePacket); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment