SHARE
TWEET

Untitled

a guest Feb 16th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.dylan.wands.spells;
  2.  
  3. import me.dylan.wands.Spell;
  4. import me.dylan.wands.spellbehaviour.WaveSpell;
  5. import org.bukkit.Particle;
  6. import org.bukkit.entity.LivingEntity;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.potion.PotionEffect;
  9. import org.bukkit.potion.PotionEffectType;
  10.  
  11. public class PoisonWave extends Spell {
  12.  
  13.     private final WaveSpell spellBehaviour;
  14.  
  15.     private PoisonWave() {
  16.         super("PoisonWave");
  17.         spellBehaviour = new WaveSpell.Builder()
  18.                 .setEffectDistance(30)
  19.                 .setEffectAreaRange(2.2F)
  20.                 .setEntityDamage(1)
  21.                 .setEntityEffects(entity -> ((LivingEntity) entity).addPotionEffect(
  22.                         new PotionEffect(PotionEffectType.POISON, 60, 4, false)
  23.                 ))
  24.                 .setVisualEffects(loc -> {
  25.                     loc.getWorld().spawnParticle(Particle.SPELL_MOB, loc, 15, 1, 1, 1, 0, null, true);
  26.                     loc.getWorld().spawnParticle(Particle.SMOKE_NORMAL, loc, 5, 1, 1, 1, 0.05, null, true);
  27.                 })
  28.                 .build();
  29.     }
  30.  
  31.     public static PoisonWave getInstance() {
  32.         return InstanceHolder.INSTANCE;
  33.     }
  34.  
  35.     private static class InstanceHolder {
  36.         private final static PoisonWave INSTANCE = new PoisonWave();
  37.     }
  38.  
  39.     @Override
  40.     protected void cast(Player player) {
  41.         spellBehaviour.executeFrom(player);
  42.     }
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top