public static void sendClickableMessage( Player p, String baseMsg, String hoverMsg, String action, String toDo) { IChatBaseComponent comp = ChatSerializer.a( "{\"text\":\"" + baseMsg + "\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"" + hoverMsg + "\"},\"clickEvent\":{\"action\":\"" + action + "\",\"value\":\"" + toDo + "\"}}"); PacketPlayOutChat pack = new PacketPlayOutChat(comp, true); ((CraftPlayer) p).getHandle().playerConnection.sendPacket(pack); }
public void send(Player player) { ((CraftPlayer) player) .getHandle() .playerConnection .sendPacket(new PacketPlayOutChat(ChatSerializer.a(toJSONString()))); }