Browse Source

PlayerCombatStats proper delays

lakebane-dex-penalty
FatBoy-DOTC 1 week ago
parent
commit
030d1110b9
  1. 7
      src/engine/objects/PlayerCharacter.java
  2. 12
      src/engine/workthreads/UpdateThread.java

7
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) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
} finally { } finally {

12
src/engine/workthreads/UpdateThread.java

@ -14,6 +14,7 @@ import engine.gameManager.SessionManager;
import engine.gameManager.SimulationManager; import engine.gameManager.SimulationManager;
import engine.objects.Bane; import engine.objects.Bane;
import engine.objects.PlayerCharacter; import engine.objects.PlayerCharacter;
import engine.objects.PlayerCombatStats;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
public class UpdateThread implements Runnable { public class UpdateThread implements Runnable {
@ -32,6 +33,17 @@ public class UpdateThread implements Runnable {
for(PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()){ for(PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()){
if (player != null) { if (player != null) {
player.doRegen(); 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) { } catch (Exception e) {

Loading…
Cancel
Save