diff --git a/src/main/kotlin/xyz/ineanto/dragon/commands/GameSubCommand.kt b/src/main/kotlin/xyz/ineanto/dragon/commands/GameSubCommand.kt
index 507d155..7ad0100 100644
--- a/src/main/kotlin/xyz/ineanto/dragon/commands/GameSubCommand.kt
+++ b/src/main/kotlin/xyz/ineanto/dragon/commands/GameSubCommand.kt
@@ -19,6 +19,11 @@ class GameSubCommand {
when (args[0]) {
"dim" -> {
+ if (RunnerDragon.STATE == GameState.WAITING) {
+ player.sendErrorMessage("Impossible de vous téléporter : le jeu n'a pas démarré.")
+ return
+ }
+
Bukkit.getOnlinePlayers().forEach {
it.teleport(WorldManager.GAME_WORLD_THE_END.spawnLocation)
}
@@ -45,17 +50,7 @@ class GameSubCommand {
"start" -> {
if (RunnerDragon.STATE != GameState.WAITING) {
- val errorMessage = Component
- .text()
- .append(
- Component.text(
- "Impossible de lancer le jeu, il a déjà démarré.",
- NamedTextColor.RED
- )
- )
- .appendNewline()
- .build()
- player.sendMessage(errorMessage)
+ player.sendErrorMessage("Impossible de lancer le jeu, il a déjà démarré.")
return
}
diff --git a/src/main/kotlin/xyz/ineanto/dragon/player/DragonPlayer.kt b/src/main/kotlin/xyz/ineanto/dragon/player/DragonPlayer.kt
index ee4f060..b924738 100644
--- a/src/main/kotlin/xyz/ineanto/dragon/player/DragonPlayer.kt
+++ b/src/main/kotlin/xyz/ineanto/dragon/player/DragonPlayer.kt
@@ -73,6 +73,21 @@ class DragonPlayer(uuid: UUID) {
bukkitPlayer.sendMessage(message)
}
+ fun sendErrorMessage(message: String) {
+ val message = Component
+ .text()
+ .append(RunnerDragon.PREFIX)
+ .appendSpace()
+ .append(
+ Component.text(
+ message,
+ NamedTextColor.RED
+ )
+ )
+ .build()
+ bukkitPlayer.sendMessage(message)
+ }
+
fun getTeam(): Team? {
return RunnerDragon.instance.teamManager.getPlayerTeam(bukkitPlayer)
}
diff --git a/src/main/kotlin/xyz/ineanto/dragon/world/WorldManager.kt b/src/main/kotlin/xyz/ineanto/dragon/world/WorldManager.kt
index 2261119..c4edef0 100644
--- a/src/main/kotlin/xyz/ineanto/dragon/world/WorldManager.kt
+++ b/src/main/kotlin/xyz/ineanto/dragon/world/WorldManager.kt
@@ -2,6 +2,7 @@ package xyz.ineanto.dragon.world
import org.apache.commons.io.FileUtils
import org.bukkit.Bukkit
+import org.bukkit.Difficulty
import org.bukkit.GameRule
import org.bukkit.Location
import org.bukkit.World
@@ -31,13 +32,14 @@ class WorldManager(private val instance: RunnerDragon) {
// Limbo is the world where players are
// held (hostage) before the game starts.
instance.logger.severe("Limbo world doesn't exist! Generating an emergency spawn...")
- LIMBO_WORLD = createWorld(LIMBO_WORLD_NAME, World.Environment.NETHER, false)
+ LIMBO_WORLD = createWorld(LIMBO_WORLD_NAME, World.Environment.NORMAL, false)
} else {
// Load the Limbo world
LIMBO_WORLD = Bukkit.createWorld(WorldCreator(LIMBO_WORLD_NAME))!!
}
LIMBO_SPAWN = LIMBO_WORLD.spawnLocation
+ LIMBO_WORLD.difficulty = Difficulty.PEACEFUL
cleanupPreviousWorlds()
return true
}