feat(world,modes): isolate parkour world, disable elytra and mark 1.4.0 as beta

This commit is contained in:
Loki 2026-10-19 20:23:45 +02:00
parent bfae9f9bc5
commit 80dcd8e59b
Signed by: boba
GPG key ID: 253067914055423B
17 changed files with 142 additions and 157 deletions

View file

@ -1,7 +1,9 @@
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;
@ -14,13 +16,37 @@ public final class ModeMessages {
}
/**
* @return true if joining is allowed; otherwise sends {@code other.joining_disabled} and returns false
* Checks whether a new parkour session may be started.
*
* <p>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.</p>
*
* @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")) {
return true;
if (!Config.CONFIG.getBoolean("joining")) {
Locales.send(player, "other.joining_disabled");
return false;
}
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");
}
}