Make finale border size configurable via Config and apply it dynamically in RoundService.

This commit is contained in:
akastijn 2026-07-11 16:52:15 +02:00
parent 244f8f6df7
commit 491e6a6050
2 changed files with 4 additions and 1 deletions

View File

@ -44,6 +44,7 @@ public class Config extends AbstractConfig {
public static Duration SAFE_PHASE = Duration.ofSeconds(30); public static Duration SAFE_PHASE = Duration.ofSeconds(30);
public static Duration TIME_TO_FINALE = Duration.ofMinutes(5); public static Duration TIME_TO_FINALE = Duration.ofMinutes(5);
public static int INITIAL_BORDER_SIZE = 5000; public static int INITIAL_BORDER_SIZE = 5000;
public static int FINALE_BORDER_SIZE = 48;
public static List<GameStage> STAGES = List.of( public static List<GameStage> STAGES = List.of(
GameStage.builder().duration(Duration.ofMinutes(5)).worldBorderSize(1000).build(), GameStage.builder().duration(Duration.ofMinutes(5)).worldBorderSize(1000).build(),
GameStage.builder().duration(Duration.ofMinutes(5)).worldBorderSize(750).build(), GameStage.builder().duration(Duration.ofMinutes(5)).worldBorderSize(750).build(),
@ -59,6 +60,7 @@ public class Config extends AbstractConfig {
int killPhaseSeconds = config.getInt(prefix, "time-to-finale-seconds", Math.toIntExact(TIME_TO_FINALE.toSeconds())); int killPhaseSeconds = config.getInt(prefix, "time-to-finale-seconds", Math.toIntExact(TIME_TO_FINALE.toSeconds()));
TIME_TO_FINALE = Duration.ofSeconds(killPhaseSeconds); TIME_TO_FINALE = Duration.ofSeconds(killPhaseSeconds);
INITIAL_BORDER_SIZE = config.getInt(prefix, "initial-border-size", INITIAL_BORDER_SIZE); INITIAL_BORDER_SIZE = config.getInt(prefix, "initial-border-size", INITIAL_BORDER_SIZE);
FINALE_BORDER_SIZE = config.getInt(prefix, "finale-border-size", FINALE_BORDER_SIZE);
ConfigurationSection configurationSection = config.getConfigurationSection(prefix + "stages"); ConfigurationSection configurationSection = config.getConfigurationSection(prefix + "stages");
if (configurationSection == null) { if (configurationSection == null) {

View File

@ -1,6 +1,7 @@
package com.alttd.hunger_games.services; package com.alttd.hunger_games.services;
import com.alttd.hunger_games.Main; import com.alttd.hunger_games.Main;
import com.alttd.hunger_games.config.Config;
import com.alttd.hunger_games.config.Messages; import com.alttd.hunger_games.config.Messages;
import com.alttd.hunger_games.data_objects.DESTINATION; import com.alttd.hunger_games.data_objects.DESTINATION;
import com.alttd.hunger_games.data_objects.PLAYER_STATE; import com.alttd.hunger_games.data_objects.PLAYER_STATE;
@ -136,7 +137,7 @@ public class RoundService implements RoundListener {
WorldBorderUtil.resetBorder(); WorldBorderUtil.resetBorder();
} }
if (roundState.equals(ROUND_STATE.FINALE)) { if (roundState.equals(ROUND_STATE.FINALE)) {
WorldBorderUtil.setSize(60); WorldBorderUtil.setSize(Config.ROUND.FINALE_BORDER_SIZE);
} }
if (!roundState.equals(ROUND_STATE.ENDED) && !roundState.equals(ROUND_STATE.PLAYER_REGISTRATION)) { if (!roundState.equals(ROUND_STATE.ENDED) && !roundState.equals(ROUND_STATE.PLAYER_REGISTRATION)) {
Bukkit.broadcast(MiniMessage.miniMessage().deserialize(Messages.GAME.NEXT_STATE, Placeholder.parsed("round", roundState.getHumanReadableName()))); Bukkit.broadcast(MiniMessage.miniMessage().deserialize(Messages.GAME.NEXT_STATE, Placeholder.parsed("round", roundState.getHumanReadableName())));