monun/kommand

java.lang.ClassCastException 오류 발생

Closed this issue · 7 comments

[14:30:49] [Server thread/ERROR]: [org.bukkit.craftbukkit.v1_17_R1.CraftServer] null initializing CursedMinecraft v1.0 (Is it up to date?)
java.lang.ExceptionInInitializerError: null
at io.github.monun.kommand.Kommand.(Kommand.kt) ~[CursedMinecraft-1.0.jar:?]
at io.github.monun.kommand.PluginKommand.register(Kommand.kt:38) ~[CursedMinecraft-1.0.jar:?]
at com.gbunny.cursedminecraft.CursedMinecraft$onLoad$1.invoke(CursedMinecraft.kt:23) ~[CursedMinecraft-1.0.jar:?]
at com.gbunny.cursedminecraft.CursedMinecraft$onLoad$1.invoke(CursedMinecraft.kt:22) ~[CursedMinecraft-1.0.jar:?]
at io.github.monun.kommand.KommandKt.kommand(Kommand.kt:43) ~[CursedMinecraft-1.0.jar:?]
at com.gbunny.cursedminecraft.CursedMinecraft.onLoad(CursedMinecraft.kt:22) ~[CursedMinecraft-1.0.jar:?]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:410) ~[patched_1.17.1.jar:git-Paper-209]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:276) ~[patched_1.17.1.jar:git-Paper-209]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1126) ~[patched_1.17.1.jar:git-Paper-209]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[patched_1.17.1.jar:git-Paper-209]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.ClassCastException: class io.github.monun.kommand.v1_17_1.NMSKommand
at java.lang.Class.asSubclass(Class.java:3853) ~[?:?]
at io.github.monun.kommand.loader.LibraryLoader.loadNMS(LibraryLoader.kt:73) ~[CursedMinecraft-1.0.jar:?]
at io.github.monun.kommand.loader.LibraryLoader.loadNMS$default(LibraryLoader.kt:53) ~[CursedMinecraft-1.0.jar:?]
at io.github.monun.kommand.Kommand$Companion.(Kommand.kt:27) ~[CursedMinecraft-1.0.jar:?]
at io.github.monun.kommand.Kommand$Companion.(Kommand.kt) ~[CursedMinecraft-1.0.jar:?]
... 11 more

https://monun.me/dev/kommand/sample-kommand/
이거보고 똑같이 쳤는데 자꾸 오류가 떠요

코드 한번 알려주실수있으신가요? 또 라이브러리도 제대로 적용되어있는지, 버전오차는 없는지 다시 확인하실수있나요?

  • monun.me는 비공식 Docs제작인데다 요새 바빠서 업데이트가 늦습니다 ㅠㅜ
  • 메인

package com.gbunny.samplekommand

import io.github.monun.kommand.kommand
import net.kyori.adventure.text.Component.text
import org.bukkit.plugin.java.JavaPlugin

class SampleKommand : JavaPlugin() {
override fun onEnable() {
kommand {
register("sample"){
executes {
sender.sendMessage(text("Hello World!"))
}
}
}
}
}

  • plugin.yml
    name: SampleKommand
    version: '${project.version}'
    main: com.gbunny.samplekommand.SampleKommand
    api-version: 1.17
    libraries:

    • io.github.monun:Kommand:2.6.6
  • pom.xml


4.0.0

<groupId>com.gbunny</groupId>
<artifactId>sampleKommand</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

<name>SampleKommand</name>

<properties>
    <java.version>1.8</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <kotlin.version>1.5.10</kotlin.version>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <createDependencyReducedPom>false</createDependencyReducedPom>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-maven-plugin</artifactId>
            <version>${kotlin.version}</version>
            <executions>
                <execution>
                    <id>compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
                <execution>
                    <id>test-compile</id>
                    <phase>test-compile</phase>
                    <goals>
                        <goal>test-compile</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <jvmTarget>1.8</jvmTarget>
            </configuration>
        </plugin>
    </plugins>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>

<repositories>
    <repository>
        <id>papermc-repo</id>
        <url>https://papermc.io/repo/repository/maven-public/</url>
    </repository>
    <repository>
        <id>sonatype</id>
        <url>https://oss.sonatype.org/content/groups/public/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>io.papermc.paper</groupId>
        <artifactId>paper-api</artifactId>
        <version>1.17.1-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib-jdk8</artifactId>
        <version>${kotlin.version}</version>
    </dependency>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-test-junit</artifactId>
        <version>${kotlin.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.github.monun</groupId>
        <artifactId>Kommand-api</artifactId>
        <version>2.6.6</version>
        <scope>compile</scope>
    </dependency>
</dependencies>

라이브러리는
[13:28:40 INFO]: [SampleKommand] Loaded library C:\Users\DGSW\Desktop\server\libraries\io\github\monun\Kommand\2.6.6\Kommand-2.6.6.jar
[13:28:40 INFO]: [SampleKommand] Loaded library C:\Users\DGSW\Desktop\server\libraries\io\github\monun\kommand-api\2.6.6\kommand-api-2.6.6.jar
이렇게 뜨면 잘 불러와 진게 맞나요?

맞는디 대소문자구분문제가있나

맞는디 대소문자구분문제가있나

TEST-1.0-SNAPSHOT.jar, annotations-22.0.0.jar, kommand-api-2.6.6.jar, kotlin-stdlib-1.5.21.jar, kotlin-stdlib-common-1.5.21.jar, kotlin-stdlib-jdk7-1.5.21.jar, kotlin-stdlib-jdk8-1.5.21.jar define 1 overlapping resource:

  • META-INF/MANIFEST.MF
    annotations-22.0.0.jar, kotlin-stdlib-1.5.21.jar, kotlin-stdlib-jdk7-1.5.21.jar, kotlin-stdlib-jdk8-1.5.21.jar define 1 overlapping classes:
  • META-INF.versions.9.module-info
    maven-shade-plugin has detected that some class files are
    present in two or more JARs. When this happens, only one
    single version of the class is copied to the uber jar.
    Usually this is not harmful and you can skip these warnings,
    otherwise try to manually exclude artifacts based on
    mvn dependency:tree -Ddetail=true and the above output.
    See http://maven.apache.org/plugins/maven-shade-plugin/

컴파일 할 때 이런 오류가 뜨는데 관련 있나요?

코틀린 버전도 바꿔보고 이것저것 해보는데 점점 미궁으로 빠지고 있어요

관련없습니다. 프로젝트 소스 자체를 한번 올려보시겠어요?
시험끝나고 포크해서 따로 패치해보겠습니다.
이슈는 닫아주세요

test.zip
ㅎㅎ...