From 3815f9df8ed08a4394d53ea9fb4396e6e8c40020 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 28 May 2024 21:30:54 -0500 Subject: [PATCH] box flag checker --- src/engine/workthreads/BoxFlagThread.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/engine/workthreads/BoxFlagThread.java b/src/engine/workthreads/BoxFlagThread.java index edc09744..20e69991 100644 --- a/src/engine/workthreads/BoxFlagThread.java +++ b/src/engine/workthreads/BoxFlagThread.java @@ -21,22 +21,23 @@ import engine.objects.*; import engine.server.MBServerStatics; import org.pmw.tinylog.Logger; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; public class BoxFlagThread implements Runnable { - public final static int THREAD_DELAY = 5000; + public final static int THREAD_DELAY_SECONDS = 10; public BoxFlagThread() { } @Override public void run() { - long nextPulse = System.currentTimeMillis(); + LocalDateTime nextPulse = LocalDateTime.now(); while(true){ - if(System.currentTimeMillis() > nextPulse) { + if(LocalDateTime.now().isAfter(nextPulse)) { for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){ if(pc.isEnteredWorld() && pc.isActive()){ @@ -58,7 +59,7 @@ public class BoxFlagThread implements Runnable { } } } - nextPulse += THREAD_DELAY; + nextPulse = nextPulse.plusSeconds(THREAD_DELAY_SECONDS); } } }