Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onEnable() {
- DustOptions red = new DustOptions(Color.RED, 1.25F);
- DustOptions yellow = new DustOptions(Color.YELLOW, 0.65F);
- DustOptions white = new DustOptions(Color.WHITE, 0.2F);
- Bukkit.getScheduler().runTaskTimer(this, () -> {
- for (Player player : Bukkit.getOnlinePlayers()) {
- Location eyeLocation = player.getEyeLocation();
- double distanceFromEyes = 1.5;
- double distanceFromEyeCenter = 0.25;
- Vector leftEye = VectorUtils.rotateVector(new Vector(distanceFromEyes, 0, distanceFromEyeCenter), eyeLocation.getYaw(), eyeLocation.getPitch());
- Vector rightEye = VectorUtils.rotateVector(new Vector(distanceFromEyes, 0, -distanceFromEyeCenter), eyeLocation.getYaw(), eyeLocation.getPitch());
- this.spawnDust(player, eyeLocation.clone().add(leftEye), red);
- this.spawnDust(player, eyeLocation.clone().add(rightEye), red);
- for (int i = 2; i <= 7; i++) {
- Vector leftEyeBeam = VectorUtils.rotateVector(new Vector(distanceFromEyes, 0, distanceFromEyeCenter + (0.15 * i)), eyeLocation.getYaw(), eyeLocation.getPitch());
- Vector rightEyeBeam = VectorUtils.rotateVector(new Vector(distanceFromEyes, 0, -distanceFromEyeCenter - (0.15 * i)), eyeLocation.getYaw(), eyeLocation.getPitch());
- this.spawnDust(player, eyeLocation.clone().add(leftEyeBeam), yellow);
- this.spawnDust(player, eyeLocation.clone().add(rightEyeBeam), yellow);
- for (int n = 0; n < 2; n++) {
- Vector leftRandomSpark = Vector.getRandom().subtract(new Vector(0.5, 0.5, 0.5)).multiply(0.2).add(leftEyeBeam);
- Vector rightRandomSpark = Vector.getRandom().subtract(new Vector(0.5, 0.5, 0.5)).multiply(0.2).add(rightEyeBeam);
- this.spawnDust(player, eyeLocation.clone().add(leftRandomSpark), white);
- this.spawnDust(player, eyeLocation.clone().add(rightRandomSpark), white);
- }
- }
- }
- }, 0, 1);
- }
- // spawns for all players other than you
- private void spawnDust(Player player, Location location, DustOptions dustOptions) {
- for (Player other : Bukkit.getOnlinePlayers()) {
- if (player == other)
- continue;
- other.spawnParticle(Particle.REDSTONE, location, 1, 0, 0, 0, dustOptions);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement