From 7c60062a4c14b71e41feec675f6db5ca3386fe96 Mon Sep 17 00:00:00 2001 From: Esophose Date: Sun, 16 Feb 2020 19:07:44 -0700 Subject: [PATCH] Fix celebration style disappearing with vanish if fixed --- .../playerparticles/styles/ParticleStyleCelebration.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleCelebration.java b/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleCelebration.java index 647fb1d..cc61927 100644 --- a/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleCelebration.java +++ b/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleCelebration.java @@ -62,11 +62,11 @@ public class ParticleStyleCelebration extends DefaultParticleStyle { if (player != null && player.getGameMode() != GameMode.SPECTATOR && permissionManager.isWorldEnabled(player.getWorld().getName())) for (ParticlePair particle : pplayer.getActiveParticles()) if (particle.getStyle() == this) - this.spawnFirework(player.getLocation(), pplayer, particle, random); + this.spawnFirework(player.getLocation(), pplayer, pplayer.getPlayer(), particle, random); for (FixedParticleEffect fixedEffect : pplayer.getFixedParticles()) if (fixedEffect.getParticlePair().getStyle() == this && permissionManager.isWorldEnabled(fixedEffect.getLocation().getWorld().getName())) - this.spawnFirework(fixedEffect.getLocation(), pplayer, fixedEffect.getParticlePair(), random); + this.spawnFirework(fixedEffect.getLocation(), pplayer, null, fixedEffect.getParticlePair(), random); } } } @@ -102,14 +102,13 @@ public class ParticleStyleCelebration extends DefaultParticleStyle { this.fuseEffect = ParticleEffect.FIREWORK; } - private void spawnFirework(final Location location, final PPlayer pplayer, final ParticlePair particle, final Random random) { + private void spawnFirework(final Location location, final PPlayer pplayer, final Player player, final ParticlePair particle, final Random random) { double angle = random.nextDouble() * Math.PI * 2; double distanceFrom = this.baseDistanceFrom + random.nextDouble() * this.distanceFromRandomizer; double dx = MathL.sin(angle) * distanceFrom; double dz = MathL.cos(angle) * distanceFrom; final Location loc = location.clone().add(dx, 1, dz); final int fuse = this.baseFuseLength + random.nextInt(this.fuseLengthRandomizer); - Player player = pplayer.getPlayer(); ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class); new BukkitRunnable() {