Fix out of bounds exception in legendary particle
This commit is contained in:
parent
da08868206
commit
7535200c35
@ -1,7 +1,7 @@
|
||||
package mineplex.core.gadget.gadgets.particle;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import java.awt.*;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -11,6 +11,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.ParticleGadget;
|
||||
@ -19,8 +21,6 @@ import mineplex.core.inventory.data.Item;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
public class ParticleLegend extends ParticleGadget
|
||||
{
|
||||
private static final double PI = Math.PI;
|
||||
@ -70,14 +70,14 @@ public class ParticleLegend extends ParticleGadget
|
||||
|
||||
for (int i = 0; i < MOVING_PARTICLES; i++)
|
||||
{
|
||||
if (_colors[i].getGreen() == 0)
|
||||
if (_colors[i % _colors.length].getGreen() == 0)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.SMOKE,
|
||||
UtilMath.gauss(player.getLocation(), 8, 4, 8), null, 0, 1, UtilParticle.ViewDist.NORMAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilParticle.playColoredParticleToAll(_colors[i], UtilParticle.ParticleType.RED_DUST,
|
||||
UtilParticle.playColoredParticleToAll(_colors[i % _colors.length], UtilParticle.ParticleType.RED_DUST,
|
||||
UtilMath.gauss(player.getLocation(), 8, 4, 8), 0, UtilParticle.ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user