From 7a978a2f5b24d6140fd782efbaa76e445fe5d211 Mon Sep 17 00:00:00 2001 From: jojo Date: Sun, 15 Nov 2020 11:53:10 +0100 Subject: [PATCH] Fix ConcurrentModificationException --- .../steamwar/bausystem/tracer/TNTTracer.java | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/TNTTracer.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/TNTTracer.java index 8ce3d96..a7ea71b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/TNTTracer.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/TNTTracer.java @@ -40,26 +40,10 @@ public class TNTTracer { private static final TraceCache traceCache = new TraceCache(); public static void init(){ - Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), () -> { - synchronized (synchronizer) { - synchronizer.notifyAll(); - } - }, 1, 20); - Bukkit.getScheduler().runTaskAsynchronously(BauSystem.getPlugin(), () -> { - while (true) { - synchronized (synchronizer) { - try { - synchronizer.wait(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - run(); - } - }); + Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), TNTTracer::run, 0, 20); } - private static void run(){ + private static void run() { for (Player p : Bukkit.getOnlinePlayers()) { if (DEBUG) { String actionBar = "§e" + TraceManager.getAllTraces().size() + " §cTraces §e" + ShowManager.get(p).getShowRadius() + " §cRadius";