From 930e8dc7d0b30908e189c912d7044f3f94373d04 Mon Sep 17 00:00:00 2001 From: jojo Date: Sun, 19 Jul 2020 19:54:58 +0200 Subject: [PATCH] Fix Updating Issue while Tracing --- .../src/de/steamwar/bausystem/tracer/TNTTracer_15.java | 2 +- .../tracer/showcallback/TracerCallbackTracing_15.java | 4 +++- .../src/de/steamwar/bausystem/tracer/TNTTracer15.java | 7 ++++++- .../src/de/steamwar/bausystem/tracer/trace/ShowStatus.java | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTTracer_15.java b/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTTracer_15.java index 7847323..feea293 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTTracer_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTTracer_15.java @@ -102,7 +102,7 @@ class TNTTracer_15 { private static float[] noValue = new float[0]; private static void update(Player p, PlayerTraceCache_15 traceCache) { - if (tracerCallbackTracing.run()) { + if (tracerCallbackTracing.run(p)) { return; } diff --git a/BauSystem_15/src/de/steamwar/bausystem/tracer/showcallback/TracerCallbackTracing_15.java b/BauSystem_15/src/de/steamwar/bausystem/tracer/showcallback/TracerCallbackTracing_15.java index b456011..16ee5b7 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/tracer/showcallback/TracerCallbackTracing_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/tracer/showcallback/TracerCallbackTracing_15.java @@ -1,8 +1,10 @@ package de.steamwar.bausystem.tracer.showcallback; +import org.bukkit.entity.Player; + @FunctionalInterface public interface TracerCallbackTracing_15 { - boolean run(); + boolean run(Player p); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/TNTTracer15.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/TNTTracer15.java index a01710d..6a9731b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/TNTTracer15.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/TNTTracer15.java @@ -45,7 +45,12 @@ public class TNTTracer15 { private static final float[] noValue = new float[0]; public static void initTNTTracer_15() { - TNTTracer_15.init(BauSystem.getPlugin(), TNTTracer15::getTracePoints, TNTTracer15::getTraceUpdatePoints, TNTTracer15::getActionBar, TNTTracer15::showMode, p -> ShowManager.get(p).isDirty(), () -> System.currentTimeMillis() - lastExplosion < 4500); + TNTTracer_15.init(BauSystem.getPlugin(), TNTTracer15::getTracePoints, TNTTracer15::getTraceUpdatePoints, TNTTracer15::getActionBar, TNTTracer15::showMode, p -> ShowManager.get(p).isDirty(), p -> { + if (System.currentTimeMillis() - lastExplosion < 4500) { + ShowManager.get(p).dirty(); + } + return System.currentTimeMillis() - lastExplosion < 4500; + }); } private static float[] accumulate(LinkedList traces) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/trace/ShowStatus.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/trace/ShowStatus.java index a9949d3..c28e118 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/trace/ShowStatus.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/trace/ShowStatus.java @@ -147,6 +147,10 @@ public class ShowStatus { return false; } + public void dirty() { + dirty = true; + } + @Override public String toString() { return "ShowStatus{" +