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
This commit is contained in:
Esophose 2020-11-26 23:17:16 -07:00
parent 9a6f33f2f1
commit f06b81a54d

View file

@ -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);
@ -148,7 +154,7 @@ public class ParticleStyleCelebration extends DefaultParticleStyle {
}
particleManager.displayParticles(pplayer, this.location.getWorld(), particle, particles, true);
this.cancel();
this.finished = true;
}
this.fuseTimer++;
}