Compare commits

...

3 Commits

4 changed files with 9 additions and 6 deletions

View File

@ -45,6 +45,7 @@ public class Config extends AbstractConfig {
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 int FINALE_BORDER_SIZE = 48;
public static int DEFAULT_BORDER_TRANSITION_SECONDS = 45;
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(),
@ -61,6 +62,7 @@ public class Config extends AbstractConfig {
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); FINALE_BORDER_SIZE = config.getInt(prefix, "finale-border-size", FINALE_BORDER_SIZE);
DEFAULT_BORDER_TRANSITION_SECONDS = config.getInt(prefix, "default-border-transition-seconds", DEFAULT_BORDER_TRANSITION_SECONDS);
ConfigurationSection configurationSection = config.getConfigurationSection(prefix + "stages"); ConfigurationSection configurationSection = config.getConfigurationSection(prefix + "stages");
if (configurationSection == null) { if (configurationSection == null) {

View File

@ -54,7 +54,6 @@ public class PlayerService implements RoundListener {
} }
case FINALE -> { case FINALE -> {
Set<UUID> players = roundService.getPlayers(PLAYER_STATE.REGISTERED); Set<UUID> players = roundService.getPlayers(PLAYER_STATE.REGISTERED);
log.info("Teleporting players {} to finale area", players);
Bukkit.getOnlinePlayers().stream() Bukkit.getOnlinePlayers().stream()
.filter(player -> players.contains(player.getUniqueId())) .filter(player -> players.contains(player.getUniqueId()))
.forEach(player -> playerTeleporterService.teleportPlayer(player, DESTINATION.FINALE_AREA)); .forEach(player -> playerTeleporterService.teleportPlayer(player, DESTINATION.FINALE_AREA));

View File

@ -31,8 +31,12 @@ public class PlayerTeleporterService implements RoundListener {
} }
public void teleportPlayer(Player player, DESTINATION destination) { public void teleportPlayer(Player player, DESTINATION destination) {
log.info("Teleporting {} to {}}", player.getName(), destination.name()); Location locationFromDestination = getLocationFromDestination(destination);
player.teleport(getLocationFromDestination(destination)); try {
player.teleportAsync(getLocationFromDestination(destination));
} catch (Exception e) {
log.error("Failed to teleport player {} to destination {} ({})", player.getName(), destination.name(), locationFromDestination, e);
}
} }
public void reset() { public void reset() {

View File

@ -12,10 +12,8 @@ import java.util.Optional;
@UtilityClass @UtilityClass
public class WorldBorderUtil { public class WorldBorderUtil {
private static final int BORDER_TRANSITION_SECONDS = 45;
public static void setSize(int size) { public static void setSize(int size) {
setSize(size, BORDER_TRANSITION_SECONDS); setSize(size, Config.ROUND.DEFAULT_BORDER_TRANSITION_SECONDS);
} }
public static void setSize(int size, int seconds) { public static void setSize(int size, int seconds) {