chore(serverstatus): NeoForge 21.1.227 업그레이드 및 컴파일러 경고 정리

- NeoForge 21.1.77 → 21.1.227, moddev 2.0.141, Kotlin 2.3.0, KFF 5.11.0
- PlayerStatsCollector: BuiltInRegistries.getKey()가 non-null을 반환하므로
  불필요한 safe call(?.) 6곳 제거
- LogUploadService: deprecated URL(String) 생성자를 URI(...).toURL()로 교체

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Caadiq 2026-04-23 14:58:21 +09:00
parent 52a49f554e
commit 158228c11d
4 changed files with 14 additions and 18 deletions

View file

@ -1,7 +1,7 @@
plugins {
id("net.neoforged.moddev") version "2.0.80"
kotlin("jvm") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
id("net.neoforged.moddev") version "2.0.141"
kotlin("jvm") version "2.3.0"
kotlin("plugin.serialization") version "2.3.0"
}
version = project.property("mod_version") as String

View file

@ -9,13 +9,13 @@ mod_authors=beemer
# NeoForge 버전
minecraft_version=1.21.1
minecraft_version_range=[1.21.1,1.22)
neo_version=21.1.77
neo_version=21.1.227
neo_version_range=[21.1.0,)
loader_version_range=[4,)
# Kotlin 버전
kotlin_version=2.0.0
kotlin_for_forge_version=5.6.0
kotlin_version=2.3.0
kotlin_for_forge_version=5.11.0
# Gradle
org.gradle.jvmargs=-Xmx3G

View file

@ -51,7 +51,7 @@ class PlayerStatsCollector {
BuiltInRegistries.BLOCK.forEach { block ->
val mined = statsManager.getValue(Stats.BLOCK_MINED.get(block))
if (mined > 0) {
val blockId = BuiltInRegistries.BLOCK.getKey(block)?.path ?: return@forEach
val blockId = BuiltInRegistries.BLOCK.getKey(block).path
itemStats.getOrPut(blockId) { ItemStat() }.mined = mined
}
}
@ -60,7 +60,7 @@ class PlayerStatsCollector {
BuiltInRegistries.ITEM.forEach { item ->
val picked = statsManager.getValue(Stats.ITEM_PICKED_UP.get(item))
if (picked > 0) {
val itemId = BuiltInRegistries.ITEM.getKey(item)?.path ?: return@forEach
val itemId = BuiltInRegistries.ITEM.getKey(item).path
itemStats.getOrPut(itemId) { ItemStat() }.pickedUp = picked
}
}
@ -69,7 +69,7 @@ class PlayerStatsCollector {
BuiltInRegistries.ITEM.forEach { item ->
val used = statsManager.getValue(Stats.ITEM_USED.get(item))
if (used > 0) {
val itemId = BuiltInRegistries.ITEM.getKey(item)?.path ?: return@forEach
val itemId = BuiltInRegistries.ITEM.getKey(item).path
itemStats.getOrPut(itemId) { ItemStat() }.used = used
}
}
@ -78,7 +78,7 @@ class PlayerStatsCollector {
BuiltInRegistries.ITEM.forEach { item ->
val crafted = statsManager.getValue(Stats.ITEM_CRAFTED.get(item))
if (crafted > 0) {
val itemId = BuiltInRegistries.ITEM.getKey(item)?.path ?: return@forEach
val itemId = BuiltInRegistries.ITEM.getKey(item).path
itemStats.getOrPut(itemId) { ItemStat() }.crafted = crafted
}
}
@ -91,9 +91,7 @@ class PlayerStatsCollector {
try {
val killed = statsManager.getValue(Stats.ENTITY_KILLED.get(entityType))
if (killed > 0) {
val entityId =
BuiltInRegistries.ENTITY_TYPE.getKey(entityType)?.path
?: return@forEach
val entityId = BuiltInRegistries.ENTITY_TYPE.getKey(entityType).path
mobStats.getOrPut(entityId) { MobStat() }.killed = killed
}
} catch (e: Exception) {}
@ -104,9 +102,7 @@ class PlayerStatsCollector {
try {
val killedBy = statsManager.getValue(Stats.ENTITY_KILLED_BY.get(entityType))
if (killedBy > 0) {
val entityId =
BuiltInRegistries.ENTITY_TYPE.getKey(entityType)?.path
?: return@forEach
val entityId = BuiltInRegistries.ENTITY_TYPE.getKey(entityType).path
mobStats.getOrPut(entityId) { MobStat() }.killedBy = killedBy
}
} catch (e: Exception) {}

View file

@ -4,7 +4,7 @@ import com.beemer.serverstatus.ServerStatusMod
import java.io.DataOutputStream
import java.io.File
import java.net.HttpURLConnection
import java.net.URL
import java.net.URI
import java.util.concurrent.Executors
/** 서버 시작 시 이전 로그 파일을 백엔드로 업로드하는 서비스 */
@ -69,7 +69,7 @@ object LogUploadService {
/** 파일 업로드 (multipart/form-data) */
private fun uploadFile(backendUrl: String, serverId: String, file: File) {
val url = URL("$backendUrl/api/admin/logs/upload")
val url = URI("$backendUrl/api/admin/logs/upload").toURL()
val boundary = "----FormBoundary${System.currentTimeMillis()}"
val connection = url.openConnection() as HttpURLConnection