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

Commit

Permalink
Update ParticleEffect.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Sentropic committed Sep 29, 2020
1 parent e42910e commit 2052823
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/com/sucy/skill/api/particle/ParticleEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
import com.sucy.skill.data.formula.IValue;
import com.sucy.skill.data.formula.value.CustomValue;
import org.bukkit.Location;
import org.bukkit.entity.Player;

import java.util.ArrayList;

/**
* A particle effect that can be played
Expand Down Expand Up @@ -163,6 +166,12 @@ public void play(Location loc, int frame, int level)
int j = 0, k = 0;

if (VersionManager.isVersionAtLeast(11300)) {
ArrayList<Player> players = new ArrayList<>();
for (Player player : loc.getWorld().getPlayers()) {
if (loc.distance(player.getLocation()) <= view) {
players.add(player);
}
}
org.bukkit.Particle effect = org.bukkit.Particle.valueOf(this.particle.type.name());
int count = this.particle.amount;
double dx = this.particle.dx;
Expand All @@ -177,7 +186,9 @@ public void play(Location loc, int frame, int level)

for (Point3D p2 : shapePoints) {
double size = this.size.compute(t, p, cs.x, cs.y, p2.x, p2.y, p2.z, level);
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);
for (Player player : players) {
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);
}
}
++j;
}
Expand Down

0 comments on commit 2052823

Please sign in to comment.