Browse Source

box flag checker

lakebane-master
FatBoy-DOTC 5 months ago
parent
commit
3815f9df8e
  1. 9
      src/engine/workthreads/BoxFlagThread.java

9
src/engine/workthreads/BoxFlagThread.java

@ -21,22 +21,23 @@ import engine.objects.*;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
public class BoxFlagThread implements Runnable { public class BoxFlagThread implements Runnable {
public final static int THREAD_DELAY = 5000; public final static int THREAD_DELAY_SECONDS = 10;
public BoxFlagThread() { public BoxFlagThread() {
} }
@Override @Override
public void run() { public void run() {
long nextPulse = System.currentTimeMillis(); LocalDateTime nextPulse = LocalDateTime.now();
while(true){ while(true){
if(System.currentTimeMillis() > nextPulse) { if(LocalDateTime.now().isAfter(nextPulse)) {
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){ for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
if(pc.isEnteredWorld() && pc.isActive()){ if(pc.isEnteredWorld() && pc.isActive()){
@ -58,7 +59,7 @@ public class BoxFlagThread implements Runnable {
} }
} }
} }
nextPulse += THREAD_DELAY; nextPulse = nextPulse.plusSeconds(THREAD_DELAY_SECONDS);
} }
} }
} }

Loading…
Cancel
Save