mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-15 06:45:04 +01:00
Add stamina recovery rates into config
This commit is contained in:
@@ -85,7 +85,17 @@ public class Config {
|
|||||||
public static class ServerOptions {
|
public static class ServerOptions {
|
||||||
public int entitySceneLimit = 2000;
|
public int entitySceneLimit = 2000;
|
||||||
public boolean spendStamina = true;
|
public boolean spendStamina = true;
|
||||||
|
public int staminaRecoveryRate = 5 * 60;
|
||||||
|
public int staminaReserveRecoveryRate = 18 * 60;
|
||||||
public Set<String> defaultPermissions = Set.of("*");
|
public Set<String> defaultPermissions = Set.of("*");
|
||||||
|
|
||||||
|
public int getStaminaRecoveryRate() {
|
||||||
|
return staminaRecoveryRate > 0 ? staminaRecoveryRate : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStaminaReserveRecoveryRate() {
|
||||||
|
return staminaReserveRecoveryRate > 0 ? staminaReserveRecoveryRate : 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
|||||||
@@ -398,7 +398,8 @@ public class Player {
|
|||||||
this.stamina += 1;
|
this.stamina += 1;
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
} else if (this.stamina < GameConstants.MAX_STAMINA_RESERVE) {
|
} 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);
|
this.staminaReserve = Math.min(this.staminaReserve + amount, GameConstants.MAX_STAMINA_RESERVE);
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
}
|
}
|
||||||
@@ -408,7 +409,7 @@ public class Player {
|
|||||||
this.nextStaminaRecover = time;
|
this.nextStaminaRecover = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.nextStaminaRecover += 5 * 60 * 1000;
|
this.nextStaminaRecover += LunarCore.getConfig().getServerOptions().getStaminaRecoveryRate() * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send packet
|
// Send packet
|
||||||
|
|||||||
Reference in New Issue
Block a user