Advertisement
Guest User

Untitled

a guest
Feb 12th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.52 KB | None | 0 0
  1.     @Override
  2.     public void onEnable() {
  3.         DustOptions red = new DustOptions(Color.RED, 1.25F);
  4.         DustOptions yellow = new DustOptions(Color.YELLOW, 0.65F);
  5.         DustOptions white = new DustOptions(Color.WHITE, 0.2F);
  6.  
  7.         Bukkit.getScheduler().runTaskTimer(this, () -> {
  8.             for (Player player : Bukkit.getOnlinePlayers()) {
  9.                 Location eyeLocation = player.getEyeLocation();
  10.                 double distanceFromEyes = 1.5;
  11.                 double distanceFromEyeCenter = 0.25;
  12.                 Vector leftEye = VectorUtils.rotateVector(new Vector(distanceFromEyes, 0, distanceFromEyeCenter), eyeLocation.getYaw(), eyeLocation.getPitch());
  13.                 Vector rightEye = VectorUtils.rotateVector(new Vector(distanceFromEyes, 0, -distanceFromEyeCenter), eyeLocation.getYaw(), eyeLocation.getPitch());
  14.                 this.spawnDust(player, eyeLocation.clone().add(leftEye), red);
  15.                 this.spawnDust(player, eyeLocation.clone().add(rightEye), red);
  16.                 for (int i = 2; i <= 7; i++) {
  17.                     Vector leftEyeBeam = VectorUtils.rotateVector(new Vector(distanceFromEyes, 0, distanceFromEyeCenter + (0.15 * i)), eyeLocation.getYaw(), eyeLocation.getPitch());
  18.                     Vector rightEyeBeam = VectorUtils.rotateVector(new Vector(distanceFromEyes, 0, -distanceFromEyeCenter - (0.15 * i)), eyeLocation.getYaw(), eyeLocation.getPitch());
  19.                     this.spawnDust(player, eyeLocation.clone().add(leftEyeBeam), yellow);
  20.                     this.spawnDust(player, eyeLocation.clone().add(rightEyeBeam), yellow);
  21.                     for (int n = 0; n < 2; n++) {
  22.                         Vector leftRandomSpark = Vector.getRandom().subtract(new Vector(0.5, 0.5, 0.5)).multiply(0.2).add(leftEyeBeam);
  23.                         Vector rightRandomSpark = Vector.getRandom().subtract(new Vector(0.5, 0.5, 0.5)).multiply(0.2).add(rightEyeBeam);
  24.                         this.spawnDust(player, eyeLocation.clone().add(leftRandomSpark), white);
  25.                         this.spawnDust(player, eyeLocation.clone().add(rightRandomSpark), white);
  26.                     }
  27.                 }
  28.             }
  29.         }, 0, 1);
  30.     }
  31.  
  32.     // spawns for all players other than you
  33.     private void spawnDust(Player player, Location location, DustOptions dustOptions) {
  34.         for (Player other : Bukkit.getOnlinePlayers()) {
  35.             if (player == other)
  36.                 continue;
  37.  
  38.             other.spawnParticle(Particle.REDSTONE, location, 1, 0, 0, 0, dustOptions);
  39.         }
  40.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement