/*
   * Called when a block is damaged.
   */
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onBlockDispense(BlockDispenseEvent event) {
    ConfigurationManager cfg = plugin.getGlobalStateManager();
    WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());

    if (wcfg.blockPotions.size() > 0) {
      ItemStack item = event.getItem();
      if (item.getType() == Material.POTION && !BukkitUtil.isWaterPotion(item)) {
        Potion potion = Potion.fromDamage(BukkitUtil.getPotionEffectBits(item));
        for (PotionEffect effect : potion.getEffects()) {
          if (potion.isSplash() && wcfg.blockPotions.contains(effect.getType())) {
            event.setCancelled(true);
            return;
          }
        }
      }
    }
  }
  @EventHandler
  public static void addPotionInfo(ItemInfoEvent event) {
    ItemStack item = event.getItem();

    if (item.getType() != Material.POTION || item.getDurability() == 0) {
      return;
    }

    Potion potion = Potion.fromItemStack(item);

    StringBuilder message = new StringBuilder(50);

    message.append(ChatColor.GRAY);

    if (potion.getType() == null) {
      return;
    }

    if (potion.isSplash()) {
      message.append("Splash ");
    }

    message.append("Potion of ");
    message.append(capitalizeFirstLetter(potion.getType().name(), '_')).append(' ');
    message.append(toRoman(potion.getLevel()));

    CommandSender sender = event.getSender();

    sender.sendMessage(message.toString());

    for (PotionEffect effect : potion.getEffects()) {
      sender.sendMessage(
          ChatColor.DARK_GRAY
              + capitalizeFirstLetter(effect.getType().getName(), '_')
              + ' '
              + toTime(effect.getDuration() / 20));
    }
  }