SteamWar/BauSystem2.0
Archiviert
12
0

Fix ParticleShowMode

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-06-26 14:08:10 +02:00
Ursprung c9e8d499ff
Commit 1f4f1e9532

Datei anzeigen

@ -29,6 +29,7 @@ import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.Vector;
import java.util.HashSet;
import java.util.Set;
@ -38,7 +39,7 @@ public class ParticleShowMode implements ShowMode<TNTPosition> {
protected final Player player;
protected final ShowModeParameter showModeParameter;
private Set<Point> positionSet = new HashSet<>();
private Set<Vector> positionSet = new HashSet<>();
private BukkitTask bukkitTask;
@ -49,15 +50,13 @@ public class ParticleShowMode implements ShowMode<TNTPosition> {
@Override
public void show(TNTPosition position) {
Location location = position.getLocation().toLocation(player.getWorld());
Point point = Point.fromLocation(location);
if (positionSet.contains(point)) {
if (positionSet.contains(position.getLocation())) {
return;
}
positionSet.add(point);
positionSet.add(position.getLocation());
if (bukkitTask == null) {
bukkitTask = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> {
positionSet.forEach(p -> player.spawnParticle(Particle.BARRIER, p.toLocation(player), 1, 0, 0, 0, 0));
positionSet.forEach(p -> player.spawnParticle(Particle.BARRIER, p.toLocation(player.getWorld()), 1, 0, 0, 0, 0));
}, 15L, 15L);
}
}