Validate particle size
This commit is contained in:
parent
26cb4474c4
commit
caebd1fed3
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -78,10 +78,12 @@ public class FrameSpawnerPlayer extends BukkitRunnable {
|
|||
return;
|
||||
}
|
||||
Frame next = iterator.next();
|
||||
if (stationary)
|
||||
if (stationary) {
|
||||
next.spawn(location, yaw);
|
||||
else
|
||||
}
|
||||
else {
|
||||
next.spawn(player.getLocation(), player.getLocation().getYaw());
|
||||
}
|
||||
}
|
||||
}.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, frameDelay);
|
||||
if (amount != -1)
|
||||
|
|
|
|||
|
|
@ -64,16 +64,16 @@ public class ParticleSet {
|
|||
public void run(Player player, PlayerSettings playerSettings) {
|
||||
if (tooSoon(player.getUniqueId()) && !player.hasPermission("apart.bypass-cooldown"))
|
||||
return;
|
||||
if (Config.DEBUG)
|
||||
Logger.info("Starting particle set % for %.", uniqueId, player.getName());
|
||||
if (Config.DEBUG) {
|
||||
log.info("Starting particle set {} for {}.", uniqueId, player.getName());
|
||||
}
|
||||
FrameSpawnerPlayer frameSpawnerPlayer = new FrameSpawnerPlayer(repeat, frames, frameDelay, player, playerSettings, aPartType, uniqueId, stationary);
|
||||
frameSpawnerPlayer.runTaskTimerAsynchronously(AltitudeParticles.getInstance(), 0, repeatDelay);
|
||||
}
|
||||
|
||||
private boolean tooSoon(UUID uuid) {
|
||||
PlayerSettings ps = PlayerSettings.getPlayer(uuid);
|
||||
if (ps.canRun(aPartType))
|
||||
{
|
||||
if (ps.canRun(aPartType)) {
|
||||
ps.run(aPartType);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user