Skip to content
This repository was archived by the owner on May 22, 2023. It is now read-only.

Commit 2052823

Browse files
committed
Update ParticleEffect.java
1 parent e42910e commit 2052823

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main/java/com/sucy/skill/api/particle/ParticleEffect.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
import com.sucy.skill.data.formula.IValue;
3535
import com.sucy.skill.data.formula.value.CustomValue;
3636
import 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

Comments
 (0)