Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void sendTitleMessage(Player player, String title, String subtitle, int fadeIn, int stay, int fadeOut){
- if(title == null){
- title = "";
- }
- if(subtitle == null){
- subtitle = "";
- }
- title = title.replace("&", "§");
- subtitle = subtitle.replace("&", "§");
- CraftPlayer craftPlayer = (CraftPlayer)player;
- PacketPlayOutTitle packetTimes = new PacketPlayOutTitle(EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut);
- craftPlayer.getHandle().playerConnection.sendPacket(packetTimes);
- IChatBaseComponent chatTitle = ChatSerializer.a("{\"text\": \"" + title + "\"}");
- PacketPlayOutTitle packetTitle = new PacketPlayOutTitle(EnumTitleAction.TITLE, chatTitle);
- craftPlayer.getHandle().playerConnection.sendPacket(packetTitle);
- IChatBaseComponent chatSubtitle = ChatSerializer.a("{\"text\": \"" + subtitle + "\"}");
- PacketPlayOutTitle packetSubtitle = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, chatSubtitle);
- craftPlayer.getHandle().playerConnection.sendPacket(packetSubtitle);
- }
- public static void sendActionbar(Player p, String message) {
- IChatBaseComponent icbc = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" +
- ChatColor.translateAlternateColorCodes('&', message) + "\"}");
- PacketPlayOutChat bar = new PacketPlayOutChat(icbc, (byte)2);
- ((CraftPlayer)p).getHandle().playerConnection.sendPacket(bar);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement