package dev.loki.loparkour.mode.base; import dev.loki.loparkour.LoParkour; import dev.loki.loparkour.config.core.Config; import dev.loki.loparkour.config.locale.Locales; import dev.loki.loparkour.world.core.World; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; /** * Shared mode messages from locale files. */ public final class ModeMessages { private ModeMessages() { } /** * Checks whether a new parkour session may be started. * *

Besides the {@code joining} switch this verifies that the configured * parkour world is actually loaded. Without it a session would be built with * null world locations and generation could leak into the player's world.

* * @return true if joining is allowed; otherwise sends the matching locale * message, logs the missing world in English and returns false */ public static boolean checkJoiningEnabled(@NotNull Player player) { if (!Config.CONFIG.getBoolean("joining")) { Locales.send(player, "other.joining_disabled"); return false; } if (World.getWorld() == null) { LoParkour.getPlugin().getLogger().severe( "Parkour world '" + World.getName() + "' is not loaded. " + "Set world.name to an existing world or let LoParkour create it; " + "joining is disabled until the world is available."); Locales.send(player, "other.world_unavailable", World.getName()); return false; } return true; } /** * Sends the short beta notice shown after a successful join. * * @param player the player who just joined */ public static void sendBetaWelcome(@NotNull Player player) { Locales.send(player, "other.beta_welcome"); } }