Add stamina recovery rates into config

This commit is contained in:
Melledy
2023-11-13 22:19:40 -08:00
parent ea62d4c3d8
commit a313903455
2 changed files with 13 additions and 2 deletions

View File

@@ -85,7 +85,17 @@ public class Config {
public static class ServerOptions {
public int entitySceneLimit = 2000;
public boolean spendStamina = true;
public int staminaRecoveryRate = 5 * 60;
public int staminaReserveRecoveryRate = 18 * 60;
public Set<String> defaultPermissions = Set.of("*");
public int getStaminaRecoveryRate() {
return staminaRecoveryRate > 0 ? staminaRecoveryRate : 1;
}
public int getStaminaReserveRecoveryRate() {
return staminaReserveRecoveryRate > 0 ? staminaReserveRecoveryRate : 1;
}
}
@Getter

View File

@@ -398,7 +398,8 @@ public class Player {
this.stamina += 1;
hasChanged = true;
} else if (this.stamina < GameConstants.MAX_STAMINA_RESERVE) {
double amount = (time - this.nextStaminaRecover) / (18D * 60D * 1000D);
double rate = LunarCore.getConfig().getServerOptions().getStaminaReserveRecoveryRate();
double amount = (time - this.nextStaminaRecover) / (rate * 1000D);
this.staminaReserve = Math.min(this.staminaReserve + amount, GameConstants.MAX_STAMINA_RESERVE);
hasChanged = true;
}
@@ -408,7 +409,7 @@ public class Player {
this.nextStaminaRecover = time;
}
this.nextStaminaRecover += 5 * 60 * 1000;
this.nextStaminaRecover += LunarCore.getConfig().getServerOptions().getStaminaRecoveryRate() * 1000;
}
// Send packet