Make holiday fireworks have more randomness fidelity

This moves the multiplication to before the cast to integer. Without this, there would only be 3 clumps of fireworks each 1 second apart. With this change, the 10 fireworks won't bunch together.
This commit is contained in:
Kane York 2013-05-29 13:58:32 -04:00
parent 0ba4bc25c7
commit 7d963508ee

View File

@ -96,13 +96,13 @@ public final class HolidayManager {
sender.sendMessage(ChatColor.BLUE + "nossr50's work and all the devs, here's a firework show!"); sender.sendMessage(ChatColor.BLUE + "nossr50's work and all the devs, here's a firework show!");
final int firework_amount = 10; final int firework_amount = 10;
for (int i = 0; i < firework_amount; i++) { for (int i = 0; i < firework_amount; i++) {
int delay = (int) (Math.random() * 3) + 4; int delay = (int) (Math.random() * 3 * 20) + 4;
mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() { mcMMO.p.getServer().getScheduler().runTaskLater(mcMMO.p, new Runnable() {
@Override @Override
public void run() { public void run() {
spawnFireworks((Player) sender); spawnFireworks((Player) sender);
} }
}, 20 * delay); }, delay);
} }
hasCelebrated.add(sender.getName()); hasCelebrated.add(sender.getName());
} }