이해도 | 초보자 |
---|---|
게임버전 (JE) | 1.20.1 |
게임버전 (BE) | 관련없음 |
1.21 플러그인을 빌드하고 실행했는데
[19:53:54 ERROR]: Could not pass event PlayerJumpEvent to studying v1.0
java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at studying-1.0.jar/org.sexygay.studying.listeners.PlayerJumpListener.playerJumpEvent(PlayerJumpListener.kt) ~[studying-1.0.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor1.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:1.21-126-7e44684]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.21.jar:1.21-126-7e44684]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[paper-1.21.jar:1.21-126-7e44684]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
at org.bukkit.event.Event.callEvent(Event.java:45) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleMovePlayer(ServerGamePacketListenerImpl.java:1418) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.network.protocol.game.ServerboundMovePlayerPacket.handle(ServerboundMovePlayerPacket.java:34) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.network.protocol.game.ServerboundMovePlayerPacket$Pos.handle(ServerboundMovePlayerPacket.java:75) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:56) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:151) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1537) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:201) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:125) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1514) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1507) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:135) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.server.MinecraftServer.managedBlock(MinecraftServer.java:1466) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1473) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1318) ~[paper-1.21.jar:1.21-126-7e44684]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:330) ~[paper-1.21.jar:1.21-126-7e44684]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:197) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:164) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
... 27 more
라고 오류가 떠요 코드 문제가 아니라 빌드 오류 같은데 도저히 찾아봐도 안나와서 질문드려요
Main.kt
package org.sexygay.studying import org.bukkit.plugin.java.JavaPlugin import org.sexygay.studying.listeners.PlayerJumpListener class Main : JavaPlugin() { override fun onEnable() { logger.info("plugin open") registerListeners() } private fun registerListeners() { server.pluginManager.registerEvents(PlayerJumpListener(), this) logger.info("registeredListeners") } override fun onDisable() { logger.info("plugin close") } }
PlayerJumpListener.kt
package org.sexygay.studying.listeners import com.destroystokyo.paper.event.player.PlayerJumpEvent import org.bukkit.event.EventHandler import org.bukkit.event.Listener class PlayerJumpListener : Listener { @EventHandler fun playerJumpEvent(event: PlayerJumpEvent) { val player = event.player player.sendMessage("you jumped!") } }
qsef1256
2024.08.06코틀린 코드를 자바 프로그램에서 실행하려면 https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-runtime 가 결과물에 포함되어 있어야 합니다, 포함 시키는 방법은 Maven/Gradle fat jar를 만드는 방법을 검색하세요
지나가던이재석
2024.08.07plugins {
kotlin("jvm") version "2.0.20-RC"
id("com.github.johnrengelman.shadow") version "8.1.1"
}
group = "org.sexygay"
version = "1.0"
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/") {
name = "papermc-repo"
}
maven("https://oss.sonatype.org/content/groups/public/") {
name = "sonatype"
}
}
dependencies {
compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
}
val targetJavaVersion = 21
kotlin {
jvmToolchain(targetJavaVersion)
}
tasks.build {
dependsOn("shadowJar")
}
tasks.processResources {
val props = mapOf("version" to version)
inputs.properties(props)
filteringCharset = "UTF-8"
filesMatching("plugin.yml") {
expand(props)
}
}
build.gradle.kts 인데요, logger.info는 작동을 하는데, Listener만 안하는데 여기를 바꾸는거죠?
지나가던이재석
2024.08.07해결했습니다. shadow 때문에 오류 뜬거라서 build를 ~all.jar로 했더니 되더군요