Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int id = Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- @Override
- public void run() {
- final List<Location> locations = (ArrayList<Location>) createCircle(p.getLocation(), 5);
- for (int i = 0; i < locations.size(); i++) {
- final int j = i;
- Bukkit.getScheduler().scheduleSyncDelayedTask(Main.this, new Runnable() {
- @Override
- public void run() {
- //Spawn the Firework, get the FireworkMeta.
- Firework fw = (Firework) p.getWorld().spawnEntity(locations.get(j), EntityType.FIREWORK);
- FireworkMeta fwm = fw.getFireworkMeta();
- //Get the type
- int rt = r.nextInt(4) + 1;
- Type type = Type.BALL;
- if (rt == 1) type = Type.BALL;
- if (rt == 2) type = Type.BALL_LARGE;
- if (rt == 3) type = Type.BURST;
- if (rt == 4) type = Type.CREEPER;
- if (rt == 5) type = Type.STAR;
- //Get our random colors
- Color c1 = Color.fromBGR(r.nextInt(255), r.nextInt(255), r.nextInt(255));
- Color c2 = Color.fromBGR(r.nextInt(255), r.nextInt(255), r.nextInt(255));
- //Create our effect with this
- FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(c1).withFade(c2).with(type).trail(r.nextBoolean()).build();
- //Then apply the effect to the meta
- fwm.addEffect(effect);
- //Generate some random power and set it
- //int rp = r.nextInt(2) + 1;
- //fwm.setPower(rp);
- //Then apply this to our rocket
- fw.setFireworkMeta(fwm);
- }
- }, i * (8 * 20L / locations.size()) );
- }
- }
- }, 0L, 8 * 20L);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement