/**
  * Set the behavior of the current editing component to display information about a statistic
  * parameter with an entity type when the client hovers over the text.
  *
  * <p>Tooltips do not inherit display characteristics, such as color and styles, from the message
  * component on which they are applied.
  *
  * @param which The statistic to display.
  * @param entity The sole entity type parameter to the statistic.
  * @return This builder instance.
  * @exception IllegalArgumentException If the statistic requires a parameter which was not
  *     supplied, or was supplied a parameter that was not required.
  */
 public FancyMessage statisticTooltip(final Statistic which, EntityType entity) {
   Type type = which.getType();
   if (type == Type.UNTYPED) {
     throw new IllegalArgumentException("That statistic needs no additional parameter!");
   }
   if (type != Type.ENTITY) {
     throw new IllegalArgumentException(
         "Wrong parameter type for that statistic - needs " + type + "!");
   }
   try {
     Object statistic =
         Reflection.getMethod(
                 Reflection.getOBCClass("CraftStatistic"),
                 "getEntityStatistic",
                 Statistic.class,
                 EntityType.class)
             .invoke(null, which, entity);
     return achievementTooltip(
         (String) Reflection.getField(Reflection.getNMSClass("Statistic"), "name").get(statistic));
   } catch (IllegalAccessException e) {
     Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
     return this;
   } catch (IllegalArgumentException e) {
     Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
     return this;
   } catch (InvocationTargetException e) {
     Bukkit.getLogger().log(Level.WARNING, "A error has occured durring invoking of method.", e);
     return this;
   }
 }
 private void send(CommandSender sender, String jsonString) {
   if (!(sender instanceof Player)) {
     sender.sendMessage(toOldMessageFormat());
     return;
   }
   Player player = (Player) sender;
   try {
     Object handle = Reflection.getHandle(player);
     Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle);
     Reflection.getMethod(connection.getClass(), "sendPacket", Reflection.getNMSClass("Packet"))
         .invoke(connection, createChatPacket(jsonString));
   } catch (IllegalArgumentException e) {
     Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
   } catch (IllegalAccessException e) {
     Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
   } catch (InstantiationException e) {
     Bukkit.getLogger().log(Level.WARNING, "Underlying class is abstract.", e);
   } catch (InvocationTargetException e) {
     Bukkit.getLogger().log(Level.WARNING, "A error has occured durring invoking of method.", e);
   } catch (NoSuchMethodException e) {
     Bukkit.getLogger().log(Level.WARNING, "Could not find method.", e);
   } catch (ClassNotFoundException e) {
     Bukkit.getLogger().log(Level.WARNING, "Could not find class.", e);
   }
 }
 /**
  * Set the behavior of the current editing component to display information about an achievement
  * when the client hovers over the text.
  *
  * <p>Tooltips do not inherit display characteristics, such as color and styles, from the message
  * component on which they are applied.
  *
  * @param which The achievement to display.
  * @return This builder instance.
  */
 public FancyMessage achievementTooltip(final Achievement which) {
   try {
     Object achievement =
         Reflection.getMethod(
                 Reflection.getOBCClass("CraftStatistic"), "getNMSAchievement", Achievement.class)
             .invoke(null, which);
     return achievementTooltip(
         (String)
             Reflection.getField(Reflection.getNMSClass("Achievement"), "name").get(achievement));
   } catch (IllegalAccessException e) {
     Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
     return this;
   } catch (IllegalArgumentException e) {
     Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
     return this;
   } catch (InvocationTargetException e) {
     Bukkit.getLogger().log(Level.WARNING, "A error has occured durring invoking of method.", e);
     return this;
   }
 }