From cbe41f7e7fb73b90e656e25ad2f1d5b67d3a6305 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 24 Sep 2023 15:36:10 +0200 Subject: [PATCH] Fix DoubleF for Script System on higher TPS Signed-off-by: yoyosource --- .../bausystem/features/script/event/EventListener.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java index 3f0a60b6..202920dd 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java @@ -57,7 +57,8 @@ public class EventListener implements Listener { static { Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> { - LAST_FS.entrySet().removeIf(entry -> TPSUtils.currentTick.get() - entry.getValue() > 4); + long millis = System.currentTimeMillis(); + LAST_FS.entrySet().removeIf(entry -> millis - entry.getValue() > 200); }, 2, 2); } @@ -77,7 +78,7 @@ public class EventListener implements Listener { if (LAST_FS.containsKey(event.getPlayer())) { ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.DoubleSwap, LuaValue.NIL, event); } else { - LAST_FS.put(event.getPlayer(), TPSUtils.currentTick.get()); + LAST_FS.put(event.getPlayer(), System.currentTimeMillis()); } }