/* * 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; } } } } }