Validate particle size

This commit is contained in:
2026-02-07 22:50:23 +01:00
parent 26cb4474c4
commit caebd1fed3
3 changed files with 14 additions and 6 deletions
@@ -200,6 +200,9 @@ public class ParticleConfig {
String color = particleInfo.getColor();
if (dataType.equals(Particle.DustOptions.class)) {
if (color != null) {
if (particleInfo.getSize() <= 1) {
throw new IllegalArgumentException("Particle size must be greater than 1");
}
particleBuilder.color(getColor(color),
particleInfo.getSize());
} else {
@@ -207,6 +210,9 @@ public class ParticleConfig {
}
} else if (dataType.equals(Particle.DustTransition.class)) {
if (color == null || particleInfo.getColorGradientEnd() != null) {
if (particleInfo.getSize() <= 1) {
throw new IllegalArgumentException("Particle size must be greater than 1");
}
particleBuilder.colorTransition(getColor(color),
getColor(particleInfo.getColorGradientEnd()),
particleInfo.getSize());