11package ru .meloncode .xmas ;
22
3+ import org .bukkit .Color ;
34import org .bukkit .Location ;
45import org .bukkit .Particle ;
6+ import org .bukkit .Particle .DustOptions ;
57import org .bukkit .entity .Player ;
68
9+ import java .util .Random ;
10+
711public class ParticleContainer {
812
13+ final static DustOptions [] COLORS = new DustOptions []{
14+ new DustOptions (Color .LIME , 1f ),
15+ new DustOptions (Color .RED , 1f ),
16+ new DustOptions (Color .AQUA , 1f ),
17+ new DustOptions (Color .YELLOW , 1f ),
18+ new DustOptions (Color .BLUE , 1f ),
19+ new DustOptions (Color .FUCHSIA , 1f )
20+ };
21+ final static Random random = new Random ("Happy 2019!" .hashCode ());
22+
923 private final Particle type ;
1024 private final float offsetX ;
1125 private final float offsetY ;
@@ -28,7 +42,11 @@ public void playEffect(Location location) {
2842 for (Player player : location .getWorld ().getPlayers ())
2943 if (player .getLocation ().distance (location ) < 16 ) {
3044 try {
31- player .spawnParticle (type , location , count , offsetX , offsetY , offsetZ , speed );
45+ if (type == Particle .REDSTONE ) {
46+ player .spawnParticle (type , location , count , offsetX , offsetY , offsetZ , speed , COLORS [random .nextInt (6 )]);
47+ } else {
48+ player .spawnParticle (type , location , count , offsetX , offsetY , offsetZ , speed );
49+ }
3250 } catch (Exception e ) {
3351 e .printStackTrace ();
3452 }
0 commit comments