From 030d1110b927ff20fdab1f9a8ad164afb91bbf20 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 22 Jan 2025 16:05:01 -0600 Subject: [PATCH] PlayerCombatStats proper delays --- src/engine/objects/PlayerCharacter.java | 7 ------- src/engine/workthreads/UpdateThread.java | 12 ++++++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 059aa2b7..45ff1954 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -5108,13 +5108,6 @@ public class PlayerCharacter extends AbstractCharacter { } - if(this.isAlive() && this.isActive && this.enteredWorld) { - if (this.combatStats == null) { - this.combatStats = new PlayerCombatStats(this); - } - PlayerCombatStats cStats = this.combatStats; - cStats.update(); - } } catch (Exception e) { Logger.error(e); } finally { diff --git a/src/engine/workthreads/UpdateThread.java b/src/engine/workthreads/UpdateThread.java index 92f1d01d..489d7af3 100644 --- a/src/engine/workthreads/UpdateThread.java +++ b/src/engine/workthreads/UpdateThread.java @@ -14,6 +14,7 @@ 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; public class UpdateThread implements Runnable { @@ -32,6 +33,17 @@ public class UpdateThread implements Runnable { for(PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()){ if (player != null) { player.doRegen(); + try { + if (player.isAlive() && player.isActive() && player.isEnteredWorld()) { + if (player.combatStats == null) { + player.combatStats = new PlayerCombatStats(player); + } + PlayerCombatStats cStats = player.combatStats; + cStats.update(); + } + }catch(Exception e){ + + } } } } catch (Exception e) {