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();
|
seen.clear();
|
||||||
blockList.clear();
|
blockList.clear();
|
||||||
if (block.getType() != Material.OBSERVER) {
|
if (block.getType() != Material.OBSERVER) {
|
||||||
return;
|
return seen.size() != size;
|
||||||
}
|
}
|
||||||
|
|
||||||
blockList.add(block);
|
blockList.add(block);
|
||||||
@ -97,6 +99,7 @@ public class ObserverTracer {
|
|||||||
calculateSolidBlock(b);
|
calculateSolidBlock(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return seen.size() != size;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnParticle(Player player, Location location, Block block) {
|
private void spawnParticle(Player player, Location location, Block block) {
|
||||||
|
@ -52,11 +52,20 @@ public class ObserverTracerListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (observerTracerMap.containsKey(event.getPlayer())) {
|
if (observerTracerMap.containsKey(event.getPlayer())) {
|
||||||
ObserverTracer observerTracer = observerTracerMap.get(event.getPlayer());
|
ObserverTracer observerTracer = observerTracerMap.get(event.getPlayer());
|
||||||
if (observerTracer.seen.contains(event.getClickedBlock().getLocation())) {
|
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), observerTracer::trace, 1L);
|
if (!observerTracer.trace()) {
|
||||||
return;
|
createNew(event);
|
||||||
}
|
}
|
||||||
|
observerTracerMap.forEach((player, o) -> {
|
||||||
|
o.trace();
|
||||||
|
});
|
||||||
|
}, 1L);
|
||||||
|
} else {
|
||||||
|
createNew(event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createNew(PlayerInteractEvent event) {
|
||||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren