From f06b81a54dfacdf94a6405643a92fcd7ff8414bf Mon Sep 17 00:00:00 2001 From: Esophose Date: Thu, 26 Nov 2020 23:17:16 -0700 Subject: [PATCH] Added a safeguard to the celebration style For some reason the task gets frozen in the last state and endlessly spawns the bursts, this fixes that rare condition --- .../styles/ParticleStyleCelebration.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleCelebration.java b/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleCelebration.java index b9491bf..5ce7a4b 100644 --- a/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleCelebration.java +++ b/src/main/java/dev/esophose/playerparticles/styles/ParticleStyleCelebration.java @@ -122,8 +122,14 @@ public class ParticleStyleCelebration extends DefaultParticleStyle { private Location location = loc; private int fuseLength = fuse; private int fuseTimer = 0; + private boolean finished = false; public void run() { + if (this.finished) { + this.cancel(); + return; + } + if (this.fuseTimer < this.fuseLength) { ParticlePair trail = ParticlePair.getNextDefault(pplayer); trail.setEffect(ParticleStyleCelebration.this.fuseEffect); @@ -147,8 +153,8 @@ public class ParticleStyleCelebration extends DefaultParticleStyle { particles.add(new PParticle(this.location.clone().add(dx, dy, dz))); } particleManager.displayParticles(pplayer, this.location.getWorld(), particle, particles, true); - - this.cancel(); + + this.finished = true; } this.fuseTimer++; }