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