Problem/Bug Fireworks no works in my plugin

Discussion in 'Bukkit Help' started by Texgabs, Nov 14, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Texgabs

    This is my code , i have more features and that works fine but the firework no,which is the problem?
    Sorry for my english not is my native language
    -------------------------------------------------------------


    Code:
                          }
                          if (e.getPlayer().hasPermission("mdJoinfirework.true")) {
                              for (Player p : Bukkit.getOnlinePlayers()) {
                                  Firework fw = (Firework) p.getWorld().spawnEntity(p.getLocation(), EntityType.FIREWORK);
                                  FireworkMeta fwm = fw.getFireworkMeta();
                                  Random r = new Random(); 
                                  int rt = r.nextInt(4) + 1;
                                  Type type = Type.BALL_LARGE;     
                                  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;
                                  int r1i = r.nextInt(17) + 1;
                                  int r2i = r.nextInt(17) + 1;
                                  Color c1 = getColor(r1i);
                                  Color c7 = getColor(r2i);
                                
                                  FireworkEffect effect = FireworkEffect.builder().flicker(r.nextBoolean()).withColor(c1).withFade(c7).with(type).trail(r.nextBoolean()).build();
                                
                                  fwm.addEffect(effect);
                                
                                  int rp = r.nextInt(2) + 1;
                                  fwm.setPower(rp);
                                
                                  fw.setFireworkMeta(fwm);
                                  }
                              }
                          }
                  }
              }
              }
            }
                              }
                              private Color getColor(int i) {
                                  Color c = null;
                                  if(i==1){
                                  c=Color.AQUA;
                                  }
                                  if(i==2){
                                  c=Color.BLACK;
                                  }
                                  if(i==3){
                                  c=Color.BLUE;
                                  }
                                  if(i==4){
                                  c=Color.FUCHSIA;
                                  }
                                  if(i==5){
                                  c=Color.GRAY;
                                  }
                                  if(i==6){
                                  c=Color.GREEN;
                                  }
                                  if(i==7){
                                  c=Color.LIME;
                                  }
                                  if(i==8){
                                  c=Color.MAROON;
                                  }
                                  if(i==9){
                                  c=Color.NAVY;
                                  }
                                  if(i==10){
                                  c=Color.OLIVE;
                                  }
                                  if(i==11){
                                  c=Color.ORANGE;
                                  }
                                  if(i==12){
                                  c=Color.PURPLE;
                                  }
                                  if(i==13){
                                  c=Color.RED;
                                  }
                                  if(i==14){
                                  c=Color.SILVER;
                                  }
                                  if(i==15){
                                  c=Color.TEAL;
                                  }
                                  if(i==16){
                                  c=Color.WHITE;
                                  }
                                  if(i==17){
                                  c=Color.YELLOW;
                                  }
                                  
                                  return c;
                                  }
                          
     
Thread Status:
Not open for further replies.

Share This Page