Skip to content

Commit

Permalink
fix: compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
rito528 committed Dec 21, 2023
1 parent af90516 commit 29d28e1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/click/seichi/originspawn/OriginSpawn.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class OriginSpawn : JavaPlugin() {
MISC_SETTINGS = MiscSettingsPersistenceImpl(this)
MISC_SETTINGS.get()

getCommand("originspawn").executor = Command
getCommand("originspawn")?.setExecutor(Command)
server.pluginManager.registerEvents(PlayerJoinListener, this)

ServerLogger.info("OriginSpawn has been enabled.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SpawnPointPersistenceImpl(private val plugin: JavaPlugin): SpawnPointPersi
val yaw = config.getDouble(ConfigItems.YAW.key).toFloat()
val pitch = config.getDouble(ConfigItems.PITCH.key).toFloat()

spawnPoint = SpawnPoint(worldName, LocX(x), LocY(y), LocZ(z), Yaw(yaw), Pitch(pitch))
spawnPoint = worldName?.let { SpawnPoint(it, LocX(x), LocY(y), LocZ(z), Yaw(yaw), Pitch(pitch)) }!!
}

return spawnPoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.bukkit.Bukkit
import org.bukkit.Location

fun Location.toSpawnPoint() =
SpawnPoint(world.name, LocX(x), LocY(y), LocZ(z), Yaw(yaw), Pitch(pitch))
world?.let { SpawnPoint(it.name, LocX(x), LocY(y), LocZ(z), Yaw(yaw), Pitch(pitch)) }

fun SpawnPoint.toBukkitLocation() = Bukkit.getWorld(worldName)?.let { world ->
Location(world, x.value, y.value, z.value, yaw.value, pitch.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ object Update : CommandExecutor("update", "スポーン地点の設定を現在
}

val spawnPoint = sender.location.toSpawnPoint()
SPAWN_POINT_PERSISTENCE.save(spawnPoint)
if (spawnPoint != null) {
SPAWN_POINT_PERSISTENCE.save(spawnPoint)
}

val updatedMessage = "スポーン地点の設定を更新しました。"
messageSender.info(updatedMessage)
Expand Down

0 comments on commit 29d28e1

Please sign in to comment.