Esempio n. 1
0
 @EventHandler
 public void splash(PotionSplashEvent event) {
   Collection<PotionEffect> effects = event.getPotion().getEffects();
   for (PotionEffect effect : effects) {
     if (effect.getType() == PotionEffectType.INCREASE_DAMAGE) {
       if (effect.getAmplifier() > 0) {
         event.setCancelled(true);
       }
     }
     if (effect.getType() == PotionEffectType.INVISIBILITY) {
       event.setCancelled(true);
     }
   }
 }
Esempio n. 2
0
 @EventHandler
 public void potionSplash(PotionSplashEvent event) {
   if (!event.getPotion().getWorld().getName().equals(getName())) return;
   event.setCancelled(true);
   Iterator iterator = event.getAffectedEntities().iterator();
   while (iterator.hasNext()) {
     LivingEntity target = (LivingEntity) iterator.next();
     if (event.getEntity().getShooter().equals(target)) {
       Player p = (Player) target;
       p.sendMessage(ChatColor.RED + "You cannot heal yourself!");
     } else {
       target.addPotionEffect(event.getPotion().getEffects().iterator().next());
     }
   }
 }
 @EventHandler(ignoreCancelled = true)
 public void onPotionSplash(PotionSplashEvent event) {
   if (projectiles.containsKey(event.getPotion())) {
     event.setCancelled(true);
   }
 }