axicer

shootParticles

Jan 21st, 2016
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. public static void shoot(Player player){
  2.         final Location loc = player.getEyeLocation();
  3.         new BukkitRunnable() {
  4.             Vector dir = loc.getDirection().normalize();
  5.             double t = 0;
  6.             @Override
  7.             public void run() {
  8.                 t += 1;
  9.                 double x = t*dir.getX();
  10.                 double y = t*dir.getY();
  11.                 double z = t*dir.getZ();
  12.                 loc.add(x, y, z);
  13.                 ParticleEffect.LAVA.display(0, 0, 0, 0, 5, loc, 10000000);
  14.                 loc.subtract(x, y, z);
  15.                 if(t > 100){
  16.                     this.cancel();
  17.                 }
  18.             }
  19.         }.runTaskTimer(pl, 0, 1);
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment