// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . // ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· // ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ // ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ // ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ // Magicbane Emulator Project © 2013 - 2022 // www.magicbane.com package engine.workthreads; import engine.Enum; import engine.gameManager.SessionManager; import engine.gameManager.SimulationManager; import engine.objects.Bane; import engine.objects.PlayerCharacter; import engine.objects.PlayerCombatStats; import org.pmw.tinylog.Logger; import java.util.concurrent.*; public class UpdateThread implements Runnable { private volatile Long lastRun; public static final Long instancedelay = 1000L; public UpdateThread() { Logger.info(" UpdateThread thread has started!"); } private static final long INSTANCE_DELAY = 1500; // Adjust as needed public void processPlayerUpdate() { try { for (PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()) { if (player != null) { try { player.update(true); } catch (Exception e) { Logger.error(e); } } } }catch(Exception e){ Logger.error(e); } //for (PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()) { // ProcessUpdate.startUpdate(player); //} } @Override public void run() { try { processPlayerUpdate(); Thread.sleep(100); } catch (Exception e) { Logger.error("Thread Execution Error", e); } } public static void startUpdateThread() { Thread updateThread; updateThread = new Thread(new UpdateThread()); updateThread.setName("updateThread"); updateThread.start(); } }