Validate particle size
This commit is contained in:
parent
26cb4474c4
commit
caebd1fed3
|
|
@ -200,6 +200,9 @@ public class ParticleConfig {
|
||||||
String color = particleInfo.getColor();
|
String color = particleInfo.getColor();
|
||||||
if (dataType.equals(Particle.DustOptions.class)) {
|
if (dataType.equals(Particle.DustOptions.class)) {
|
||||||
if (color != null) {
|
if (color != null) {
|
||||||
|
if (particleInfo.getSize() <= 1) {
|
||||||
|
throw new IllegalArgumentException("Particle size must be greater than 1");
|
||||||
|
}
|
||||||
particleBuilder.color(getColor(color),
|
particleBuilder.color(getColor(color),
|
||||||
particleInfo.getSize());
|
particleInfo.getSize());
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -207,6 +210,9 @@ public class ParticleConfig {
|
||||||
}
|
}
|
||||||
} else if (dataType.equals(Particle.DustTransition.class)) {
|
} else if (dataType.equals(Particle.DustTransition.class)) {
|
||||||
if (color == null || particleInfo.getColorGradientEnd() != null) {
|
if (color == null || particleInfo.getColorGradientEnd() != null) {
|
||||||
|
if (particleInfo.getSize() <= 1) {
|
||||||
|
throw new IllegalArgumentException("Particle size must be greater than 1");
|
||||||
|
}
|
||||||
particleBuilder.colorTransition(getColor(color),
|
particleBuilder.colorTransition(getColor(color),
|
||||||
getColor(particleInfo.getColorGradientEnd()),
|
getColor(particleInfo.getColorGradientEnd()),
|
||||||
particleInfo.getSize());
|
particleInfo.getSize());
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,13 @@ public class FrameSpawnerPlayer extends BukkitRunnable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Frame next = iterator.next();
|
Frame next = iterator.next();
|
||||||
if (stationary)
|
if (stationary) {
|
||||||
next.spawn(location, yaw);
|
next.spawn(location, yaw);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
next.spawn(player.getLocation(), player.getLocation().getYaw());
|
next.spawn(player.getLocation(), player.getLocation().getYaw());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
|
}.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
|
||||||
if (amount != -1)
|
if (amount != -1)
|
||||||
amount--;
|
amount--;
|
||||||
|
|
|
||||||
|
|
@ -64,16 +64,16 @@ public class ParticleSet {
|
||||||
public void run(Player player, PlayerSettings playerSettings) {
|
public void run(Player player, PlayerSettings playerSettings) {
|
||||||
if (tooSoon(player.getUniqueId()) && !player.hasPermission("apart.bypass-cooldown"))
|
if (tooSoon(player.getUniqueId()) && !player.hasPermission("apart.bypass-cooldown"))
|
||||||
return;
|
return;
|
||||||
if (Config.DEBUG)
|
if (Config.DEBUG) {
|
||||||
Logger.info("Starting particle set % for %.", uniqueId, player.getName());
|
log.info("Starting particle set {} for {}.", uniqueId, player.getName());
|
||||||
|
}
|
||||||
FrameSpawnerPlayer frameSpawnerPlayer = new FrameSpawnerPlayer(repeat, frames, frameDelay, player, playerSettings, aPartType, uniqueId, stationary);
|
FrameSpawnerPlayer frameSpawnerPlayer = new FrameSpawnerPlayer(repeat, frames, frameDelay, player, playerSettings, aPartType, uniqueId, stationary);
|
||||||
frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, repeatDelay);
|
frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, repeatDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean tooSoon(UUID uuid) {
|
private boolean tooSoon(UUID uuid) {
|
||||||
PlayerSettings ps = PlayerSettings.getPlayer(uuid);
|
PlayerSettings ps = PlayerSettings.getPlayer(uuid);
|
||||||
if (ps.canRun(aPartType))
|
if (ps.canRun(aPartType)) {
|
||||||
{
|
|
||||||
ps.run(aPartType);
|
ps.run(aPartType);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user