Fix ObserverTracerListener
Fix ObserverTracer Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
cd80c0a741
Commit
c558db31b3
@ -53,11 +53,13 @@ public class ObserverTracer {
|
||||
}
|
||||
}
|
||||
|
||||
public void trace() {
|
||||
public boolean trace() {
|
||||
int size = seen.size();
|
||||
|
||||
seen.clear();
|
||||
blockList.clear();
|
||||
if (block.getType() != Material.OBSERVER) {
|
||||
return;
|
||||
return seen.size() != size;
|
||||
}
|
||||
|
||||
blockList.add(block);
|
||||
@ -97,6 +99,7 @@ public class ObserverTracer {
|
||||
calculateSolidBlock(b);
|
||||
}
|
||||
}
|
||||
return seen.size() != size;
|
||||
}
|
||||
|
||||
private void spawnParticle(Player player, Location location, Block block) {
|
||||
|
@ -52,11 +52,20 @@ public class ObserverTracerListener implements Listener {
|
||||
}
|
||||
if (observerTracerMap.containsKey(event.getPlayer())) {
|
||||
ObserverTracer observerTracer = observerTracerMap.get(event.getPlayer());
|
||||
if (observerTracer.seen.contains(event.getClickedBlock().getLocation())) {
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), observerTracer::trace, 1L);
|
||||
return;
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
if (!observerTracer.trace()) {
|
||||
createNew(event);
|
||||
}
|
||||
observerTracerMap.forEach((player, o) -> {
|
||||
o.trace();
|
||||
});
|
||||
}, 1L);
|
||||
} else {
|
||||
createNew(event);
|
||||
}
|
||||
}
|
||||
|
||||
private void createNew(PlayerInteractEvent event) {
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren