java.lang.NoSuchMethodError 에러
Closed this issue · 2 comments
dytroc commented
마크 버전: 1.17.1
Kommand 버전: 2.0.0 [io.github.monun:kommand:2.0.0]
Kotlin 버전: Kotlin 1.5.10
내용:
Kommand를 테스트하기 위해서 테스트용 플러그인을 만들었는데, 서버에는 해당 로그와 함께 뜨면서 플러그인이 꺼집니다.
java.lang.NoSuchMethodError: 'net.minecraft.commands.CommandDispatcher net.minecraft.server.dedicated.DedicatedServer.getCommands()'
at io.github.monun.kommand.v1_17_1.NMSKommand.register(NMSKommand.kt:14) ~[?:?]
at io.github.monun.kommand.internal.AbstractKommand.register(AbstractKommand.kt:17) ~[?:?]
at io.github.monun.kommand.Kommand$Companion.register(Kommand.kt) ~[?:?]
at com.github.dytroInc.sample.plugin.SamplePlugin.onEnable(SamplePlugin.kt:44) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.17.1.jar:git-Paper-100]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-100]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-100]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:518) ~[patched_1.17.1.jar:git-Paper-100]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:432) ~[patched_1.17.1.jar:git-Paper-100]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.reload(CraftServer.java:957) ~[patched_1.17.1.jar:git-Paper-100]
at org.bukkit.Bukkit.reload(Bukkit.java:769) ~[patched_1.17.1.jar:git-Paper-100]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:54) ~[patched_1.17.1.jar:git-Paper-100]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.17.1.jar:git-Paper-100]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:821) ~[patched_1.17.1.jar:git-Paper-100]
at com.github.monun.autoupdate.plugin.AutoUpdatePlugin.run(AutoUpdatePlugin.kt:47) ~[?:?]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.17.1.jar:git-Paper-100]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.17.1.jar:git-Paper-100]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1490) ~[patched_1.17.1.jar:git-Paper-100]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:479) ~[patched_1.17.1.jar:git-Paper-100]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1406) ~[patched_1.17.1.jar:git-Paper-100]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1188) ~[patched_1.17.1.jar:git-Paper-100]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[patched_1.17.1.jar:git-Paper-100]
at java.lang.Thread.run(Thread.java:831) [?:?]
코드는 kommand-debug 모듈에 있는 걸 복붙했습니다.
package com.github.dytroInc.sample.plugin
import com.destroystokyo.paper.profile.PlayerProfile
import com.google.gson.JsonObject
import io.github.monun.kommand.Kommand
import io.github.monun.kommand.KommandArgument
import io.github.monun.kommand.StringType
import io.github.monun.kommand.getValue
import io.github.monun.kommand.loader.LibraryLoader
import io.github.monun.kommand.wrapper.BlockPosition3D
import io.github.monun.kommand.wrapper.EntityAnchor
import io.github.monun.kommand.wrapper.Position3D
import io.github.monun.kommand.wrapper.Rotation
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.Component.text
import org.bukkit.*
import org.bukkit.block.Block
import org.bukkit.block.data.BlockData
import org.bukkit.enchantments.Enchantment
import org.bukkit.entity.Entity
import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack
import org.bukkit.plugin.java.JavaPlugin
import org.bukkit.potion.PotionEffectType
import java.util.*
/**
* @author Dytro
*
* Forked from monun/paper-sample
*/
class SamplePlugin : JavaPlugin() {
override fun onEnable() {
// Code copied from kommand-debug module in monun/kommand
logger.info(LibraryLoader.bukkitVersion)
logger.info(LibraryLoader.minecraftVersion)
logger.info(LibraryLoader.libraryVersion)
val bool = KommandArgument.bool()
val int = KommandArgument.int()
val word = KommandArgument.string(StringType.SINGLE_WORD)
val string = KommandArgument.string(StringType.QUOTABLE_PHRASE)
val greedy = KommandArgument.string(StringType.GREEDY_PHRASE)
Kommand.register("my") {
then("age") {
then("age" to int) {
executes {
val age: Int by it
Bukkit.broadcast(text("내 나이는 $age 살입니다."))
}
}
}
then("flag") {
then("flag" to bool) {
executes {
val flag: Boolean by it
Bukkit.broadcast(text("플래그 $flag"))
}
}
}
then("word") {
then("text" to word) {
executes {
val text: String by it
Bukkit.broadcast(text("word $text"))
}
}
}
then("string") {
then("text" to string) {
executes {
val text: String by it
Bukkit.broadcast(text("quote $text"))
}
}
}
then("greedy") {
then("text" to greedy) {
executes {
val text: String by it
Bukkit.broadcast(text("greedy $text"))
}
}
}
then("color") {
then("color" to KommandArgument.color()) {
executes {
val color: ChatColor by it
Bukkit.broadcast(text("$color color"))
}
}
}
then("component") {
then("component" to KommandArgument.component()) {
executes {
val component: Component by it
Bukkit.broadcast(component)
}
}
}
then("compoundTag") {
then("compoundTag" to KommandArgument.compoundTag()) {
executes {
val compoundTag: JsonObject by it
Bukkit.broadcast(text(compoundTag.toString()))
}
}
}
then("dimension") {
then("world" to KommandArgument.dimension()) {
executes {
val world: World by it
Bukkit.broadcast(text(world.toString()))
}
}
}
then("entityAnchor") {
then("entityAnchor" to KommandArgument.entityAnchor()) {
executes {
val entityAnchor: EntityAnchor by it
Bukkit.broadcast(text("anchor ${entityAnchor.name}"))
}
}
}
then("entity") {
then("entity" to KommandArgument.entity()) {
executes {
val entity: Entity by it
Bukkit.broadcast(text("entity $entity"))
}
}
}
then("entities") {
then("entities" to KommandArgument.entities()) {
executes {
val entities: Collection<Entity> by it
Bukkit.broadcast(text("entities $entities"))
}
}
}
then("player") {
then("player" to KommandArgument.player()) {
executes {
val player: Player by it
Bukkit.broadcast(text("player $player"))
}
}
}
then("players") {
then("players" to KommandArgument.players()) {
executes {
val players: Collection<Player> by it
Bukkit.broadcast(text("players $players"))
}
}
}
then("summonable") {
then("summonable" to KommandArgument.summonableEntity()) {
executes {
val summonable: NamespacedKey by it
Bukkit.broadcast(text("summonable $summonable"))
}
}
}
then("profile") {
then("profile" to KommandArgument.profile()) {
executes {
val profile: Collection<PlayerProfile> by it
Bukkit.broadcast(text(profile.toString()))
}
}
}
then("enchantment") {
then("enchantment" to KommandArgument.enchantment()) {
executes {
val enchantment: Enchantment by it
Bukkit.broadcast(text(enchantment.toString()))
}
}
}
then("mobeffect") {
then("mobeffect" to KommandArgument.mobEffect()) {
executes {
val mobeffect: PotionEffectType by it
Bukkit.broadcast(text("mobeffect ${mobeffect.name}"))
}
}
}
//
then("blockPredicate") {
requires {
it.playerOrNull != null
}
then("predicate" to KommandArgument.blockPredicate()) {
executes {
val predicate: (Block) -> Boolean by it
val flag = predicate(it.source.player.location.add(0.0, -1.0, 0.0).block)
Bukkit.broadcast(text("$flag predicate"))
}
}
}
then("blockState") {
then("state" to KommandArgument.blockState()) {
executes {
val state: BlockData by it
val asString = state.getAsString(true)
Bukkit.broadcast(text("blockData: $asString"))
}
}
}
then("blockPosition") {
requires {
it.playerOrNull != null
}
then("position" to KommandArgument.blockPosition()) {
executes {
val position: BlockPosition3D by it
Bukkit.broadcast(text(position.toBlock(it.source.player.world).type.translationKey))
}
}
}
then("position") {
requires {
it.playerOrNull != null
}
then("position" to KommandArgument.position()) {
executes {
val position: Position3D by it
Bukkit.broadcast(text("${position.asVector.distance(it.source.player.location.toVector())} far"))
}
}
}
then("rotation") {
requires {
it.playerOrNull != null
}
then("rotation" to KommandArgument.rotation()) {
executes {
val rotation: Rotation by it
// it.source.player.setRotation(rotation.yaw, rotation.pitch)
Bukkit.broadcast(text("[${rotation.yaw}, ${rotation.pitch}]"))
}
}
}
then("swizzle") {
then("swizzle" to KommandArgument.swizzle()) {
executes {
val swizzle: EnumSet<Axis> by it
Bukkit.broadcast(text(swizzle.joinToString()))
}
}
}
then("item") {
requires {
it.playerOrNull != null
}
then("item" to KommandArgument.item()) {
executes {
val item: ItemStack by it
it.source.player.inventory.addItem(item)
}
}
}
then("itemPredicate") {
requires {
it.playerOrNull != null
}
then("predicate" to KommandArgument.itemPredicate()) {
executes {
val predicate: (ItemStack) -> Boolean by it
val flag = predicate(it.source.player.inventory.itemInMainHand)
Bukkit.broadcast(text("$flag predicate"))
}
}
}
}
}
}
이와 같은 코드에서 오류가 발생하네요.
StayCake commented
현재 해당 문제가 merge 되었으나 추가 릴리즈가 지연되고 있는 것으로 확인되고 있습니다.
dytroc commented
현재 해당 문제가 merge 되었으나 추가 릴리즈가 지연되고 있는 것으로 확인되고 있습니다.
아 그렇군요, 감사합니다.