Advertisement
Guest User

pastasous

a guest
Apr 18th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.22 KB | None | 0 0
  1. public class Snowballs {
  2.  
  3. static double y = 0.3;
  4.  
  5. public static void castSpell(){
  6. final Player p = Spell.getCaster();
  7.  
  8. new BukkitRunnable() {
  9. int i=0;
  10. @Override
  11. public void run() {
  12. if (i >= 5)this.cancel();
  13.  
  14. final Snowball ball1 = p.launchProjectile(Snowball.class);
  15. final Snowball ball2 = p.launchProjectile(Snowball.class);
  16. final Snowball ball3 = p.launchProjectile(Snowball.class);
  17. final Snowball ball4 = p.launchProjectile(Snowball.class);
  18. final Snowball ball5 = p.launchProjectile(Snowball.class);
  19. final Snowball ball6 = p.launchProjectile(Snowball.class);
  20. final Snowball ball7 = p.launchProjectile(Snowball.class);
  21. final Snowball ball8 = p.launchProjectile(Snowball.class);
  22.  
  23. ball1.setVelocity(new Vector(1, y, 0));
  24. ball2.setVelocity(new Vector(-1, y, 0));
  25. ball3.setVelocity(new Vector(0, y, 1));
  26. ball4.setVelocity(new Vector(0, y, -1));
  27. ball5.setVelocity(new Vector(1, y, 1));
  28. ball6.setVelocity(new Vector(1, y, -1));
  29. ball7.setVelocity(new Vector(-1, y, 1));
  30. ball8.setVelocity(new Vector(-1, y, -1));
  31.  
  32. new BukkitRunnable() {
  33.  
  34. @Override
  35. public void run() {
  36. if (ball1.isOnGround() || !ball1.isValid()){this.cancel();ParticleEffect.sendToLocation(ParticleEffect.EXPLODE, ball1.getLocation(), 1, 1, 1, 1, 10);
  37. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball1.getLocation(), 1, 1, 1, 1.5f, 15);}
  38. Spell.damage(ball1.getLocation(), 3, 1, false);
  39. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball1.getLocation(), 0, 0, 0, 0.05f, 1);
  40. ParticleEffect.sendToLocation(ParticleEffect.SNOWBALL_HIT, ball1.getLocation(), 0, 0, 0, 0.05f, 1);
  41. }
  42. }.runTaskTimer(Main.plugin, 0, 0);
  43. new BukkitRunnable() {
  44.  
  45. @Override
  46. public void run() {
  47. if (ball2.isOnGround() || !ball2.isValid()){this.cancel();ParticleEffect.sendToLocation(ParticleEffect.EXPLODE, ball2.getLocation(), 1, 1, 1, 1, 10);
  48. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball2.getLocation(), 1, 1, 1, 1.5f, 15);}
  49. Spell.damage(ball2.getLocation(), 3, 1, false);
  50. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball2.getLocation(), 0, 0, 0, 0.05f, 1);
  51. ParticleEffect.sendToLocation(ParticleEffect.SNOWBALL_HIT, ball2.getLocation(), 0, 0, 0, 0.05f, 1);
  52. }
  53. }.runTaskTimer(Main.plugin, 0, 0);
  54. new BukkitRunnable() {
  55.  
  56. @Override
  57. public void run() {
  58. if (ball3.isOnGround() || !ball3.isValid()){this.cancel();ParticleEffect.sendToLocation(ParticleEffect.EXPLODE, ball3.getLocation(), 1, 1, 1, 1, 10);
  59. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball3.getLocation(), 1, 1, 1, 1.5f, 15);}
  60. Spell.damage(ball3.getLocation(), 3, 1, false);
  61. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball3.getLocation(), 0, 0, 0, 0.05f, 1);
  62. ParticleEffect.sendToLocation(ParticleEffect.SNOWBALL_HIT, ball3.getLocation(), 0, 0, 0, 0.05f, 1);
  63. }
  64. }.runTaskTimer(Main.plugin, 0, 0);
  65. new BukkitRunnable() {
  66.  
  67. @Override
  68. public void run() {
  69. if (ball4.isOnGround() || !ball4.isValid()){this.cancel();ParticleEffect.sendToLocation(ParticleEffect.EXPLODE, ball4.getLocation(), 1, 1, 1, 1, 10);
  70. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball4.getLocation(), 1, 1, 1, 1.5f, 15);}
  71. Spell.damage(ball4.getLocation(), 3, 1, false);
  72. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball4.getLocation(), 0, 0, 0, 0.05f, 1);
  73. ParticleEffect.sendToLocation(ParticleEffect.SNOWBALL_HIT, ball4.getLocation(), 0, 0, 0, 0.05f, 1);
  74. }
  75. }.runTaskTimer(Main.plugin, 0, 0);
  76. new BukkitRunnable() {
  77.  
  78. @Override
  79. public void run() {
  80. if (ball5.isOnGround() || !ball5.isValid()){this.cancel();ParticleEffect.sendToLocation(ParticleEffect.EXPLODE, ball5.getLocation(), 1, 1, 1, 1, 10);
  81. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball5.getLocation(), 1, 1, 1, 1.5f, 15);}
  82. Spell.damage(ball5.getLocation(), 3, 1, false);
  83. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball5.getLocation(), 0, 0, 0, 0.05f, 1);
  84. ParticleEffect.sendToLocation(ParticleEffect.SNOWBALL_HIT, ball5.getLocation(), 0, 0, 0, 0.05f, 1);
  85. }
  86. }.runTaskTimer(Main.plugin, 0, 0);
  87. new BukkitRunnable() {
  88.  
  89. @Override
  90. public void run() {
  91. if (ball6.isOnGround() || !ball6.isValid()){this.cancel();ParticleEffect.sendToLocation(ParticleEffect.EXPLODE, ball6.getLocation(), 1, 1, 1, 1, 10);
  92. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball6.getLocation(), 1, 1, 1, 1.5f, 15);}
  93. Spell.damage(ball6.getLocation(), 3, 1, false);
  94. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball6.getLocation(), 0, 0, 0, 0.05f, 1);
  95. ParticleEffect.sendToLocation(ParticleEffect.SNOWBALL_HIT, ball6.getLocation(), 0, 0, 0, 0.05f, 1);
  96. }
  97. }.runTaskTimer(Main.plugin, 0, 0);
  98. new BukkitRunnable() {
  99.  
  100. @Override
  101. public void run() {
  102. if (ball7.isOnGround() || !ball7.isValid()){this.cancel();ParticleEffect.sendToLocation(ParticleEffect.EXPLODE, ball7.getLocation(), 1, 1, 1, 1, 10);
  103. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball7.getLocation(), 1, 1, 1, 1.5f, 15);}
  104. Spell.damage(ball7.getLocation(), 3, 1, false);
  105. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball7.getLocation(), 0, 0, 0, 0.05f, 1);
  106. ParticleEffect.sendToLocation(ParticleEffect.SNOWBALL_HIT, ball7.getLocation(), 0, 0, 0, 0.05f, 1);
  107. }
  108. }.runTaskTimer(Main.plugin, 0, 0);
  109. new BukkitRunnable() {
  110.  
  111. @Override
  112. public void run() {
  113. if (ball8.isOnGround() || !ball8.isValid()){this.cancel();ParticleEffect.sendToLocation(ParticleEffect.EXPLODE, ball8.getLocation(), 1, 1, 1, 1, 10);
  114. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball8.getLocation(), 1, 1, 1, 1.5f, 15);}
  115. Spell.damage(ball8.getLocation(), 3, 1, false);
  116. ParticleEffect.sendToLocation(ParticleEffect.CLOUD, ball8.getLocation(), 0, 0, 0, 0.05f, 1);
  117. ParticleEffect.sendToLocation(ParticleEffect.SNOWBALL_HIT, ball8.getLocation(), 0, 0, 0, 0.05f, 1);
  118. }
  119. }.runTaskTimer(Main.plugin, 0, 0);
  120.  
  121. i++;
  122. }
  123. }.runTaskTimer(Main.plugin, 0, 4*2);;
  124. }
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement