|  |  | @ -5475,11 +5475,12 @@ public class PlayerCharacter extends AbstractCharacter { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     return; |  |  |  |                     return; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 this.updateMovementState(); |  |  |  |                 this.updateMovementState(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 this.regenerateHealth(); |  |  |  |                 boolean updateHealth = this.regenerateHealth(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 this.regenerateMana(); |  |  |  |                 boolean updateMana = this.regenerateMana(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 this.regenerateStamina(); |  |  |  |                 boolean updateStamina = this.regenerateStamina(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 this.consumeStamina(); |  |  |  |                 boolean consumeStamina = this.consumeStamina(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 this.syncClient(); |  |  |  |                 if(updateHealth || updateMana || updateStamina || consumeStamina) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     this.syncClient(); | 
			
		
	
		
		
			
				
					
					|  |  |  |             } catch (Exception e) { |  |  |  |             } catch (Exception e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 Logger.error(e); |  |  |  |                 Logger.error(e); | 
			
		
	
		
		
			
				
					
					|  |  |  |             } finally { |  |  |  |             } finally { | 
			
		
	
	
		
		
			
				
					|  |  | @ -5489,7 +5490,7 @@ public class PlayerCharacter extends AbstractCharacter { | 
			
		
	
		
		
			
				
					
					|  |  |  |         //ChatManager.chatSystemInfo(this,"HEALTH: " + this.health.get() + " MANA: " + this.mana.get() + " STAM: " + this.stamina.get());
 |  |  |  |         //ChatManager.chatSystemInfo(this,"HEALTH: " + this.health.get() + " MANA: " + this.mana.get() + " STAM: " + this.stamina.get());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void regenerateHealth(){ |  |  |  |     public boolean regenerateHealth(){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         Long regenTime; |  |  |  |         Long regenTime; | 
			
		
	
		
		
			
				
					
					|  |  |  |         Long currentTime = System.currentTimeMillis(); |  |  |  |         Long currentTime = System.currentTimeMillis(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         regenTime = this.timestamps.getOrDefault("LastRegenHealth", currentTime); |  |  |  |         regenTime = this.timestamps.getOrDefault("LastRegenHealth", currentTime); | 
			
		
	
	
		
		
			
				
					|  |  | @ -5504,23 +5505,23 @@ public class PlayerCharacter extends AbstractCharacter { | 
			
		
	
		
		
			
				
					
					|  |  |  |         float healthRegenerated = onePercent * rate * secondsPassed; |  |  |  |         float healthRegenerated = onePercent * rate * secondsPassed; | 
			
		
	
		
		
			
				
					
					|  |  |  |         //ChatManager.chatSystemInfo(this,"HEALTH REGENERATED: " + healthRegenerated + " SECONDS PASSED: " + secondsPassed);
 |  |  |  |         //ChatManager.chatSystemInfo(this,"HEALTH REGENERATED: " + healthRegenerated + " SECONDS PASSED: " + secondsPassed);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         boolean workedHealth = false; |  |  |  |         boolean workedHealth = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |         float old,mod; |  |  |  |         float old = this.health.get(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         float mod = old + healthRegenerated; | 
			
		
	
		
		
			
				
					
					|  |  |  |         while(!workedHealth) { |  |  |  |         while(!workedHealth) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             old = this.health.get(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             mod = old + healthRegenerated; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (mod > this.healthMax) |  |  |  |             if (mod > this.healthMax) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 mod = healthMax; |  |  |  |                 mod = healthMax; | 
			
		
	
		
		
			
				
					
					|  |  |  |             else if (mod <= 0) { |  |  |  |             else if (mod <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (this.isAlive.compareAndSet(true, false)) |  |  |  |                 if (this.isAlive.compareAndSet(true, false)) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     killCharacter("Water"); |  |  |  |                     killCharacter("Water"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 return; |  |  |  |                 return false; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             workedHealth = this.health.compareAndSet(old, mod); |  |  |  |             workedHealth = this.health.compareAndSet(old, mod); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         this.timestamps.put("LastRegenHealth",currentTime); |  |  |  |         this.timestamps.put("LastRegenHealth",currentTime); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return mod > old; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void regenerateMana(){ |  |  |  |     public boolean regenerateMana(){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         Long regenTime; |  |  |  |         Long regenTime; | 
			
		
	
		
		
			
				
					
					|  |  |  |         Long currentTime = System.currentTimeMillis(); |  |  |  |         Long currentTime = System.currentTimeMillis(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         regenTime = this.timestamps.getOrDefault("LastRegenMana", currentTime); |  |  |  |         regenTime = this.timestamps.getOrDefault("LastRegenMana", currentTime); | 
			
		
	
	
		
		
			
				
					|  |  | @ -5535,10 +5536,10 @@ public class PlayerCharacter extends AbstractCharacter { | 
			
		
	
		
		
			
				
					
					|  |  |  |         float manaRegenerated = onePercent * secondsPassed * rate; |  |  |  |         float manaRegenerated = onePercent * secondsPassed * rate; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         boolean workedMana = false; |  |  |  |         boolean workedMana = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |         float old,mod; |  |  |  |         float  old = this.mana.get(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         float mod = old + manaRegenerated; | 
			
		
	
		
		
			
				
					
					|  |  |  |         while(!workedMana) { |  |  |  |         while(!workedMana) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             old = this.mana.get(); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             mod = old + manaRegenerated; |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             if (mod > this.manaMax) |  |  |  |             if (mod > this.manaMax) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 mod = manaMax; |  |  |  |                 mod = manaMax; | 
			
		
	
		
		
			
				
					
					|  |  |  |             else if (mod < 0) |  |  |  |             else if (mod < 0) | 
			
		
	
	
		
		
			
				
					|  |  | @ -5547,14 +5548,15 @@ public class PlayerCharacter extends AbstractCharacter { | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         this.timestamps.put("LastRegenMana",currentTime); |  |  |  |         this.timestamps.put("LastRegenMana",currentTime); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return mod > old; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void regenerateStamina(){ |  |  |  |     public boolean regenerateStamina(){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         Long currentTime = System.currentTimeMillis(); |  |  |  |         Long currentTime = System.currentTimeMillis(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(this.isMoving() || this.isFlying() || !this.canBreathe) { |  |  |  |         if(this.isMoving() || this.isFlying() || !this.canBreathe) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             this.timestamps.put("LastRegenStamina",currentTime); |  |  |  |             this.timestamps.put("LastRegenStamina",currentTime); | 
			
		
	
		
		
			
				
					
					|  |  |  |             return; |  |  |  |             return false; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         Long regenTime; |  |  |  |         Long regenTime; | 
			
		
	
	
		
		
			
				
					|  |  | @ -5571,10 +5573,9 @@ public class PlayerCharacter extends AbstractCharacter { | 
			
		
	
		
		
			
				
					
					|  |  |  |         float staminaRegenerated = secondsPassed * ratio; // Stamina regenerates 1 point per `rate` seconds
 |  |  |  |         float staminaRegenerated = secondsPassed * ratio; // Stamina regenerates 1 point per `rate` seconds
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         boolean workedStamina = false; |  |  |  |         boolean workedStamina = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |         float old, mod; |  |  |  |         float old = this.stamina.get(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         float mod = old + staminaRegenerated; | 
			
		
	
		
		
			
				
					
					|  |  |  |         while (!workedStamina) { |  |  |  |         while (!workedStamina) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             old = this.stamina.get(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             mod = old + staminaRegenerated; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (mod > this.staminaMax) |  |  |  |             if (mod > this.staminaMax) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 mod = staminaMax; |  |  |  |                 mod = staminaMax; | 
			
		
	
		
		
			
				
					
					|  |  |  |             else if (mod < 0) |  |  |  |             else if (mod < 0) | 
			
		
	
	
		
		
			
				
					|  |  | @ -5583,8 +5584,9 @@ public class PlayerCharacter extends AbstractCharacter { | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         //ChatManager.chatSystemInfo(this, "STAM: " + this.stamina.get() + " / " + this.staminaMax);
 |  |  |  |         //ChatManager.chatSystemInfo(this, "STAM: " + this.stamina.get() + " / " + this.staminaMax);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         this.timestamps.put("LastRegenStamina", currentTime); |  |  |  |         this.timestamps.put("LastRegenStamina", currentTime); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return mod > old; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void consumeStamina(){ |  |  |  |     public boolean consumeStamina(){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         Long regenTime; |  |  |  |         Long regenTime; | 
			
		
	
		
		
			
				
					
					|  |  |  |         Long currentTime = System.currentTimeMillis(); |  |  |  |         Long currentTime = System.currentTimeMillis(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         regenTime = this.timestamps.getOrDefault("LastConsumeStamina", currentTime); |  |  |  |         regenTime = this.timestamps.getOrDefault("LastConsumeStamina", currentTime); | 
			
		
	
	
		
		
			
				
					|  |  | @ -5594,7 +5596,7 @@ public class PlayerCharacter extends AbstractCharacter { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(!this.isMoving() && !this.isFlying() && this.canBreathe) { |  |  |  |         if(!this.isMoving() && !this.isFlying() && this.canBreathe) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             this.timestamps.put("LastConsumeStamina",currentTime); |  |  |  |             this.timestamps.put("LastConsumeStamina",currentTime); | 
			
		
	
		
		
			
				
					
					|  |  |  |             return; |  |  |  |             return false; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(!this.combat){ |  |  |  |         if(!this.combat){ | 
			
		
	
		
		
			
				
					
					|  |  |  |             consumption = 0.4f * secondsPassed; |  |  |  |             consumption = 0.4f * secondsPassed; | 
			
		
	
	
		
		
			
				
					|  |  | @ -5607,10 +5609,9 @@ public class PlayerCharacter extends AbstractCharacter { | 
			
		
	
		
		
			
				
					
					|  |  |  |             consumption = 2.0f * secondsPassed; |  |  |  |             consumption = 2.0f * secondsPassed; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         boolean workedStamina = false; |  |  |  |         boolean workedStamina = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |         float old,mod; |  |  |  |         float old = this.stamina.get(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         float mod = old - consumption; | 
			
		
	
		
		
			
				
					
					|  |  |  |         while (!workedStamina) { |  |  |  |         while (!workedStamina) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             old = this.stamina.get(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             mod = old - consumption; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (mod <= 0) |  |  |  |             if (mod <= 0) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 mod = 0; |  |  |  |                 mod = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |             workedStamina = this.stamina.compareAndSet(old, mod); |  |  |  |             workedStamina = this.stamina.compareAndSet(old, mod); | 
			
		
	
	
		
		
			
				
					|  |  | @ -5618,27 +5619,28 @@ public class PlayerCharacter extends AbstractCharacter { | 
			
		
	
		
		
			
				
					
					|  |  |  |         //ChatManager.chatSystemInfo(this, "STAM: " + this.stamina.get() + " / " + this.staminaMax);
 |  |  |  |         //ChatManager.chatSystemInfo(this, "STAM: " + this.stamina.get() + " / " + this.staminaMax);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         this.timestamps.put("LastConsumeStamina",currentTime); |  |  |  |         this.timestamps.put("LastConsumeStamina",currentTime); | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(this.stamina.get() == 0){ |  |  |  |         if(this.stamina.get() == 0){ | 
			
		
	
		
		
			
				
					
					|  |  |  |             this.consumeHealth(secondsPassed); |  |  |  |             return this.consumeHealth(secondsPassed); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return mod < old; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void consumeHealth(float secondsPassed){ |  |  |  |     public boolean consumeHealth(float secondsPassed){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         float consumption = 2.0f * secondsPassed; |  |  |  |         float consumption = 2.0f * secondsPassed; | 
			
		
	
		
		
			
				
					
					|  |  |  |         boolean workedHealth = false; |  |  |  |         boolean workedHealth = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |         float old,mod; |  |  |  |         float old = this.health.get(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         float mod = old - consumption; | 
			
		
	
		
		
			
				
					
					|  |  |  |         while(!workedHealth) { |  |  |  |         while(!workedHealth) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             old = this.health.get(); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             mod = old - consumption; |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             if (mod > this.healthMax) |  |  |  |             if (mod > this.healthMax) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 mod = healthMax; |  |  |  |                 mod = healthMax; | 
			
		
	
		
		
			
				
					
					|  |  |  |             else if (mod <= 0) { |  |  |  |             else if (mod <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (this.isAlive.compareAndSet(true, false)) |  |  |  |                 if (this.isAlive.compareAndSet(true, false)) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     killCharacter("Water"); |  |  |  |                     killCharacter("Water"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 return; |  |  |  |                 return true; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             workedHealth = this.health.compareAndSet(old, mod); |  |  |  |             workedHealth = this.health.compareAndSet(old, mod); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         //ChatManager.chatSystemInfo(this, "HEALTH: " + this.health.get() + " / " + this.healthMax);
 |  |  |  |         return mod < old; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     enum RecoveryType{ |  |  |  |     enum RecoveryType{ | 
			
		
	
	
		
		
			
				
					|  |  | 
 |