3434import com .sucy .skill .data .formula .IValue ;
3535import com .sucy .skill .data .formula .value .CustomValue ;
3636import org .bukkit .Location ;
37+ import org .bukkit .entity .Player ;
38+
39+ import java .util .ArrayList ;
3740
3841/**
3942 * A particle effect that can be played
@@ -163,6 +166,12 @@ public void play(Location loc, int frame, int level)
163166 int j = 0 , k = 0 ;
164167
165168 if (VersionManager .isVersionAtLeast (11300 )) {
169+ ArrayList <Player > players = new ArrayList <>();
170+ for (Player player : loc .getWorld ().getPlayers ()) {
171+ if (loc .distance (player .getLocation ()) <= view ) {
172+ players .add (player );
173+ }
174+ }
166175 org .bukkit .Particle effect = org .bukkit .Particle .valueOf (this .particle .type .name ());
167176 int count = this .particle .amount ;
168177 double dx = this .particle .dx ;
@@ -177,7 +186,9 @@ public void play(Location loc, int frame, int level)
177186
178187 for (Point3D p2 : shapePoints ) {
179188 double size = this .size .compute (t , p , cs .x , cs .y , p2 .x , p2 .y , p2 .z , level );
180- loc .getWorld ().spawnParticle (effect , p1 .x * animSize + this .animDir .rotateX (p2 , trig [j ]) * size + loc .getX (), p1 .y * animSize + this .animDir .rotateY (p2 , trig [j ]) * size + loc .getY (), p1 .z * animSize + this .animDir .rotateZ (p2 , trig [j ]) * size + loc .getZ (), count , dx , dy , dz , (double ) speed , data );
189+ for (Player player : players ) {
190+ player .spawnParticle (effect , p1 .x * animSize + this .animDir .rotateX (p2 , trig [j ]) * size + loc .getX (), p1 .y * animSize + this .animDir .rotateY (p2 , trig [j ]) * size + loc .getY (), p1 .z * animSize + this .animDir .rotateZ (p2 , trig [j ]) * size + loc .getZ (), count , dx , dy , dz , speed , data );
191+ }
181192 }
182193 ++j ;
183194 }
0 commit comments