Update flag capture radius to use configurable value

Replaced the hardcoded 10-block radius with a configurable value from GameConfig.FLAG.CAPTURE_RADIUS. This ensures the capture radius can be easily adjusted without code changes and improves flexibility.
This commit is contained in:
Teriuihi 2025-02-09 22:00:51 +01:00
parent 498ed774a4
commit 8411db57a1

View File

@ -119,7 +119,7 @@ public class Flag implements Runnable {
} }
private void spawnParticlesOnSquareBorder(World world, Location center) { private void spawnParticlesOnSquareBorder(World world, Location center) {
double size = 10; double size = GameConfig.FLAG.CAPTURE_RADIUS;
double step = 0.2; double step = 0.2;
Location finalCenter = center.clone().add(0, 0.5, 0); Location finalCenter = center.clone().add(0, 0.5, 0);
Bukkit.getScheduler().runTask(main, () -> { Bukkit.getScheduler().runTask(main, () -> {
@ -214,7 +214,7 @@ public class Flag implements Runnable {
/** /**
* Updates the score of teams based on the nearby players within a specified range. * Updates the score of teams based on the nearby players within a specified range.
* This method identifies nearby players around the current location within a 10-block radius, * This method identifies nearby players around the current location within a CAPTURE_RADIUS-block radius,
* determines their respective teams, and calculates the team with the maximum number of players * determines their respective teams, and calculates the team with the maximum number of players
* in proximity. If there is a tie for the maximum count, the method exits without updating scores. * in proximity. If there is a tie for the maximum count, the method exits without updating scores.
* If a single team has the highest number of nearby players, scores are updated accordingly: * If a single team has the highest number of nearby players, scores are updated accordingly: