Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.RuntimeException: failed to load scoreboard-library implementation #76

Open
ItsHarshXD opened this issue Jan 2, 2025 · 14 comments

Comments

@ItsHarshXD
Copy link

Hey there this error is coming up:

[02:51:54 ERROR]: Error occurred while enabling CivilizationRoyale vBuild 1a (Is it up to date?)
java.lang.RuntimeException: failed to load scoreboard-library implementation
        at net.matrixcreations.libs.scoreboardlibrary.api.ScoreboardLibrary.loadScoreboardLibrary(ScoreboardLibrary.java:49) ~[?:?]
        at net.matrixcreations.civilizationroyale.CivilizationRoyale.startSystems(CivilizationRoyale.java:283) ~[?:?]
        at net.matrixcreations.civilizationroyale.CivilizationRoyale.onMiniGameEnable(CivilizationRoyale.java:176) ~[?:?]
        at pl.timsixth.minigameapi.api.MiniGame.onEnable(MiniGame.java:107) ~[?:?]
        at Loader-BattleRoyale-1.0-SNAPSHOT.jar-out (3).jar/me.athishh.seraphim.Loader.onEnable(Loader.java:73) ~[Loader-BattleRoyale-1.0-SNAPSHOT.jar-out (3).jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:288) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:520) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:655) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:604) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:743) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:488) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:322) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:310) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.api.ScoreboardLibrary.loadScoreboardLibrary(ScoreboardLibrary.java:40) ~[?:?]
        ... 16 more
Caused by: java.lang.RuntimeException: couldn't initialize packet adapter
        at net.matrixcreations.libs.scoreboardlibrary.implementation.PacketAdapterLoader.loadPacketAdapter(PacketAdapterLoader.java:28) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.ScoreboardLibraryImpl.<init>(ScoreboardLibraryImpl.java:62) ~[?:?]
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.api.ScoreboardLibrary.loadScoreboardLibrary(ScoreboardLibrary.java:40) ~[?:?]
        ... 16 more
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.PacketAdapterLoader.loadPacketAdapter(PacketAdapterLoader.java:26) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.ScoreboardLibraryImpl.<init>(ScoreboardLibraryImpl.java:62) ~[?:?]
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.api.ScoreboardLibrary.loadScoreboardLibrary(ScoreboardLibrary.java:40) ~[?:?]
        ... 16 more
Caused by: java.lang.ExceptionInInitializerError: failed to find chat component fromJson method
        at net.matrixcreations.libs.scoreboardlibrary.implementation.packetAdapter.modern.ComponentProviderImpl.<clinit>(ComponentProviderImpl.java:41) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.packetAdapter.modern.PacketAdapterProviderImpl.<init>(PacketAdapterProviderImpl.java:36) ~[?:?]
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.PacketAdapterLoader.loadPacketAdapter(PacketAdapterLoader.java:26) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.ScoreboardLibraryImpl.<init>(ScoreboardLibraryImpl.java:62) ~[?:?]
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.api.ScoreboardLibrary.loadScoreboardLibrary(ScoreboardLibrary.java:40) ~[?:?]
        ... 16 more

Build.gradle file:

plugins {
    id 'java'
    id 'com.gradleup.shadow' version '8.3.5'
    id 'maven-publish'
}

group = 'net.matrixcreations'
version = '1.0.4'

def scoreboardLibraryVersion = "2.2.2"

repositories {
    mavenCentral()
    maven { url 'https://repo.papermc.io/repository/maven-public/' }
    maven { url 'https://papermc.io/repo/repository/maven-public/' }
    maven { url 'https://oss.sonatype.org/content/groups/public/' }
    maven { url 'https://jitpack.io' }
    maven { url 'https://repo.nexomc.com/releases' }
    maven { url 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
    maven { url uri('https://repo.codemc.org/repository/maven-public/') }
    maven { url uri('https://repo.onarandombox.com/content/groups/public/') }
    maven { url 'https://repo.dmulloy2.net/repository/public/' }
    maven { url 'https://repo.infernalsuite.com/repository/maven-snapshots/' }
    maven { url 'https://repo.rapture.pw/repository/maven-releases/' }
    maven { url 'https://repo.lushplugins.org/releases/' }
    maven { url = 'https://maven.maxhenkel.de/repository/public' }
}

dependencies {
    shadow localGroovy()
    shadow gradleApi()

    // Compile-only dependencies
    compileOnly 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT'
    compileOnly 'org.projectlombok:lombok:1.18.32'
    compileOnly 'org.graalvm.sdk:nativeimage:24.1.1'
    compileOnly 'com.mojang:authlib:1.5.25'
    compileOnly 'com.nexomc:nexo:0.4.0'
    compileOnly 'com.github.LoneDev6:API-ItemsAdder:3.6.3-beta-14'
    compileOnly 'me.clip:placeholderapi:2.11.6'
    compileOnly files('MatrixGlidersAPI Build 2a.jar')
    compileOnly files('LoaderAPI.jar')
    compileOnly files('SCore-5.24.12.8.jar')
    compileOnly 'com.onarandombox.multiversecore:multiverse-core:4.3.12'
    compileOnly 'com.arcaniax:HeadDatabase-API:1.3.2'

    // Implementation dependencies
    implementation files('api-2.0.0.jar')
    implementation files('SpectraAPI.jar')
    implementation files('advancedslot-4.1.13.2.jar')
    implementation files('configurablegui-4.1.13.2.jar')
    implementation files('core-4.1.13.2.jar')
    implementation files('pagination-4.1.13.2.jar')
    implementation "de.maxhenkel.voicechat:voicechat-api:2.5.27"
    implementation "dev.jorel:commandapi-bukkit-shade-mojang-mapped:9.7.0"
    implementation 'org.graalvm.sdk:graal-sdk:24.1.1'
    implementation 'com.mchange:c3p0:0.10.1'
    implementation 'com.github.cryptomorin:XSeries:12.1.0'
    implementation 'io.papermc:paperlib:1.0.7'
    implementation 'com.github.ItsHarshXD:WorldTemplateAPI:1.0.1'
    implementation 'com.google.code.gson:gson:2.11.0'
    implementation 'net.megavex:scoreboard-library-api:$scoreboardLibraryVersion'
    runtimeOnly 'net.megavex:scoreboard-library-implementation:$scoreboardLibraryVersion'
    runtimeOnly 'net.megavex:scoreboard-library-modern:$scoreboardLibraryVersion:mojmap'
    runtimeOnly 'net.megavex:scoreboard-library-packetevents:$scoreboardLibraryVersion'
    implementation 'net.kyori:adventure-api:4.18.0'
    implementation 'net.kyori:adventure-text-minimessage:4.18.0'
    implementation 'net.kyori:adventure-text-serializer-legacy:4.18.0'
    implementation 'com.github.retrooper:packetevents-spigot:2.7.0'

    // Test dependencies
    testCompileOnly 'org.projectlombok:lombok:1.18.32'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
    annotationProcessor 'org.projectlombok:lombok:1.18.32'
}

java {
    sourceCompatibility = JavaVersion.VERSION_21
    targetCompatibility = JavaVersion.VERSION_21
}

def targetJavaVersion = 21

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8'
    options.release.set(targetJavaVersion)
}

// Configure resource processing
processResources {
    def props = [version: version]
    inputs.properties props
    filteringCharset 'UTF-8'
    filesMatching('.yml') {
        expand props
    }
}

shadowJar {
    relocate 'com.cryptomorin.xseries', 'net.matrixcreations.libs.xseries'
    relocate 'io.papermc.lib', 'net.matrixcreations.libs.paperlib'
    relocate 'net.matrixcreations.worldTemplateAPI', 'net.matrixcreations.libs.templateapi'
    relocate 'dev.jorel.commandapi', 'net.matrixcreations.libs.commandapi'
    relocate 'com.github.retrooper.packetevents', 'net.matrixcreations.libs.packetevents'
    relocate 'net.kyori', 'net.matrixcreations.libs.kyori'
    relocate 'net.megavex.scoreboardlibrary', 'net.matrixcreations.libs.scoreboardlibrary'

    manifest {
        attributes['paperweight-mappings-namespace'] = 'mojang'
    }
}

// Build dependencies
tasks.build.dependsOn(shadowJar)

// Task to export JARs
tasks.register('exportJars') {
    doLast {
        def outputDir = new File('libs')
        outputDir.mkdirs()

        configurations.each { configuration ->
            if (configuration.isCanBeResolved()) {
                configuration.resolvedConfiguration.resolvedArtifacts.each { artifact ->
                    def fileName = "${artifact.moduleVersion.id.group}-${artifact.moduleVersion.id.name}-${artifact.moduleVersion.id.version}.jar"
                    def srcFile = artifact.file
                    def destFile = new File(outputDir, fileName)

                    if (srcFile.exists() && srcFile.name.endsWith('.jar')) {
                        ant.copy(file: srcFile, toFile: destFile)
                        println "Copied: $fileName"
                    }
                }
            }
        }

        println "\nAll JARs have been exported to: ${outputDir.absolutePath}"
    }
}

// Publishing configuration
publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java  // Publish the main Java component
        }
    }
    repositories {
        maven {
            url = uri("${System.getProperty('user.home')}/.m2/repository")
        }
    }
}
@vytskalt
Copy link
Collaborator

vytskalt commented Jan 2, 2025

I slightly modified your build.gradle and it appears to work for me

plugins {
    id 'java'
    id 'com.gradleup.shadow' version '8.3.5'
    id 'maven-publish'
}

group = 'net.matrixcreations'
version = '1.0.4'

def scoreboardLibraryVersion = "2.2.2"

repositories {
    mavenCentral()
    maven { url 'https://repo.papermc.io/repository/maven-public/' }
    maven { url 'https://papermc.io/repo/repository/maven-public/' }
    maven { url 'https://oss.sonatype.org/content/groups/public/' }
    maven { url 'https://jitpack.io' }
    maven { url 'https://repo.nexomc.com/releases' }
    maven { url 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
    maven { url uri('https://repo.codemc.org/repository/maven-public/') }
    maven { url uri('https://repo.onarandombox.com/content/groups/public/') }
    maven { url 'https://repo.dmulloy2.net/repository/public/' }
    maven { url 'https://repo.infernalsuite.com/repository/maven-snapshots/' }
    maven { url 'https://repo.rapture.pw/repository/maven-releases/' }
    maven { url 'https://repo.lushplugins.org/releases/' }
    maven { url = 'https://maven.maxhenkel.de/repository/public' }
}

dependencies {
    shadow localGroovy()
    shadow gradleApi()

    // Compile-only dependencies
    compileOnly 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT'
    compileOnly 'org.projectlombok:lombok:1.18.32'
    compileOnly 'org.graalvm.sdk:nativeimage:24.1.1'
    compileOnly 'com.mojang:authlib:1.5.25'
    compileOnly 'com.nexomc:nexo:0.4.0'
    compileOnly 'com.github.LoneDev6:API-ItemsAdder:3.6.3-beta-14'
    compileOnly 'me.clip:placeholderapi:2.11.6'
//    compileOnly files('MatrixGlidersAPI Build 2a.jar')
//    compileOnly files('LoaderAPI.jar')
//    compileOnly files('SCore-5.24.12.8.jar')
    compileOnly 'com.onarandombox.multiversecore:multiverse-core:4.3.12'
    compileOnly 'com.arcaniax:HeadDatabase-API:1.3.2'

    // Implementation dependencies
//    implementation files('api-2.0.0.jar')
//    implementation files('SpectraAPI.jar')
//    implementation files('advancedslot-4.1.13.2.jar')
//    implementation files('configurablegui-4.1.13.2.jar')
//    implementation files('core-4.1.13.2.jar')
//    implementation files('pagination-4.1.13.2.jar')
    implementation "de.maxhenkel.voicechat:voicechat-api:2.5.27"
    implementation "dev.jorel:commandapi-bukkit-shade-mojang-mapped:9.7.0"
    implementation 'org.graalvm.sdk:graal-sdk:24.1.1'
    implementation 'com.mchange:c3p0:0.10.1'
    implementation 'com.github.cryptomorin:XSeries:12.1.0'
    implementation 'io.papermc:paperlib:1.0.7'
    implementation 'com.github.ItsHarshXD:WorldTemplateAPI:1.0.1'
    implementation 'com.google.code.gson:gson:2.11.0'
    implementation 'net.megavex:scoreboard-library-api:'+scoreboardLibraryVersion
    runtimeOnly 'net.megavex:scoreboard-library-implementation:'+scoreboardLibraryVersion
    runtimeOnly 'net.megavex:scoreboard-library-modern:'+scoreboardLibraryVersion+':mojmap'
    runtimeOnly 'net.megavex:scoreboard-library-packetevents:'+scoreboardLibraryVersion
    implementation 'net.kyori:adventure-api:4.18.0'
    implementation 'net.kyori:adventure-text-minimessage:4.18.0'
    implementation 'net.kyori:adventure-text-serializer-legacy:4.18.0'
    implementation 'net.kyori:adventure-text-serializer-gson:4.18.0'
    implementation 'com.github.retrooper:packetevents-spigot:2.7.0'

    // Test dependencies
    testCompileOnly 'org.projectlombok:lombok:1.18.32'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
    annotationProcessor 'org.projectlombok:lombok:1.18.32'

}

java {
    sourceCompatibility = JavaVersion.VERSION_21
    targetCompatibility = JavaVersion.VERSION_21
}

def targetJavaVersion = 21

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8'
    options.release.set(targetJavaVersion)
}

// Configure resource processing
processResources {
    def props = [version: version]
    inputs.properties props
    filteringCharset 'UTF-8'
    filesMatching('.yml') {
        expand props
    }
}

shadowJar {
    relocate 'com.cryptomorin.xseries', 'net.matrixcreations.libs.xseries'
    relocate 'io.papermc.lib', 'net.matrixcreations.libs.paperlib'
    relocate 'net.matrixcreations.worldTemplateAPI', 'net.matrixcreations.libs.templateapi'
    relocate 'dev.jorel.commandapi', 'net.matrixcreations.libs.commandapi'
    relocate 'com.github.retrooper.packetevents', 'net.matrixcreations.libs.packetevents'
    relocate 'net.kyori', 'net.matrixcreations.libs.kyori'
    relocate 'net.megavex.scoreboardlibrary', 'net.matrixcreations.libs.scoreboardlibrary'

    manifest {
        attributes['paperweight-mappings-namespace'] = 'mojang'
    }
}

// Build dependencies
tasks.build.dependsOn(shadowJar)

// Task to export JARs
tasks.register('exportJars') {
    doLast {
        def outputDir = new File('libs')
        outputDir.mkdirs()

        configurations.each { configuration ->
            if (configuration.isCanBeResolved()) {
                configuration.resolvedConfiguration.resolvedArtifacts.each { artifact ->
                    def fileName = "${artifact.moduleVersion.id.group}-${artifact.moduleVersion.id.name}-${artifact.moduleVersion.id.version}.jar"
                    def srcFile = artifact.file
                    def destFile = new File(outputDir, fileName)

                    if (srcFile.exists() && srcFile.name.endsWith('.jar')) {
                        ant.copy(file: srcFile, toFile: destFile)
                        println "Copied: $fileName"
                    }
                }
            }
        }

        println "\nAll JARs have been exported to: ${outputDir.absolutePath}"
    }
}
public class Main extends JavaPlugin implements Listener {
    private ScoreboardLibrary sc;
    private TeamManager teamManager;

    @Override
    public void onEnable() {
        try {
            sc = ScoreboardLibrary.loadScoreboardLibrary(this);
        } catch (NoPacketAdapterAvailableException e) {
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        teamManager = sc.createTeamManager();
        getServer().getPluginManager().registerEvents(this, this);
    }

    @Override
    public void onDisable() {
        teamManager.close();
        sc.close();
    }

    @EventHandler
    public void join(PlayerJoinEvent event) {
        teamManager.addPlayer(event.getPlayer());

        final var team = teamManager.createIfAbsent("what");
        team.defaultDisplay().addEntry(event.getPlayer().getName());
        team.defaultDisplay().prefix(Component.text("[test] "));
    }

    @EventHandler
    public void quit(PlayerJoinEvent event) {
        teamManager.addPlayer(event.getPlayer());
    }
}

I would need more info about your environment to reproduce error error.

@vytskalt
Copy link
Collaborator

vytskalt commented Jan 2, 2025

You appear to be using Mojang mappings so I assume you're only targeting modern versions of Paper and not Spigot. In that case you don't need to shade packetevents, gson, paperlib etc

@ItsHarshXD
Copy link
Author

I slightly modified your build.gradle and it appears to work for me

plugins {
    id 'java'
    id 'com.gradleup.shadow' version '8.3.5'
    id 'maven-publish'
}

group = 'net.matrixcreations'
version = '1.0.4'

def scoreboardLibraryVersion = "2.2.2"

repositories {
    mavenCentral()
    maven { url 'https://repo.papermc.io/repository/maven-public/' }
    maven { url 'https://papermc.io/repo/repository/maven-public/' }
    maven { url 'https://oss.sonatype.org/content/groups/public/' }
    maven { url 'https://jitpack.io' }
    maven { url 'https://repo.nexomc.com/releases' }
    maven { url 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
    maven { url uri('https://repo.codemc.org/repository/maven-public/') }
    maven { url uri('https://repo.onarandombox.com/content/groups/public/') }
    maven { url 'https://repo.dmulloy2.net/repository/public/' }
    maven { url 'https://repo.infernalsuite.com/repository/maven-snapshots/' }
    maven { url 'https://repo.rapture.pw/repository/maven-releases/' }
    maven { url 'https://repo.lushplugins.org/releases/' }
    maven { url = 'https://maven.maxhenkel.de/repository/public' }
}

dependencies {
    shadow localGroovy()
    shadow gradleApi()

    // Compile-only dependencies
    compileOnly 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT'
    compileOnly 'org.projectlombok:lombok:1.18.32'
    compileOnly 'org.graalvm.sdk:nativeimage:24.1.1'
    compileOnly 'com.mojang:authlib:1.5.25'
    compileOnly 'com.nexomc:nexo:0.4.0'
    compileOnly 'com.github.LoneDev6:API-ItemsAdder:3.6.3-beta-14'
    compileOnly 'me.clip:placeholderapi:2.11.6'
//    compileOnly files('MatrixGlidersAPI Build 2a.jar')
//    compileOnly files('LoaderAPI.jar')
//    compileOnly files('SCore-5.24.12.8.jar')
    compileOnly 'com.onarandombox.multiversecore:multiverse-core:4.3.12'
    compileOnly 'com.arcaniax:HeadDatabase-API:1.3.2'

    // Implementation dependencies
//    implementation files('api-2.0.0.jar')
//    implementation files('SpectraAPI.jar')
//    implementation files('advancedslot-4.1.13.2.jar')
//    implementation files('configurablegui-4.1.13.2.jar')
//    implementation files('core-4.1.13.2.jar')
//    implementation files('pagination-4.1.13.2.jar')
    implementation "de.maxhenkel.voicechat:voicechat-api:2.5.27"
    implementation "dev.jorel:commandapi-bukkit-shade-mojang-mapped:9.7.0"
    implementation 'org.graalvm.sdk:graal-sdk:24.1.1'
    implementation 'com.mchange:c3p0:0.10.1'
    implementation 'com.github.cryptomorin:XSeries:12.1.0'
    implementation 'io.papermc:paperlib:1.0.7'
    implementation 'com.github.ItsHarshXD:WorldTemplateAPI:1.0.1'
    implementation 'com.google.code.gson:gson:2.11.0'
    implementation 'net.megavex:scoreboard-library-api:'+scoreboardLibraryVersion
    runtimeOnly 'net.megavex:scoreboard-library-implementation:'+scoreboardLibraryVersion
    runtimeOnly 'net.megavex:scoreboard-library-modern:'+scoreboardLibraryVersion+':mojmap'
    runtimeOnly 'net.megavex:scoreboard-library-packetevents:'+scoreboardLibraryVersion
    implementation 'net.kyori:adventure-api:4.18.0'
    implementation 'net.kyori:adventure-text-minimessage:4.18.0'
    implementation 'net.kyori:adventure-text-serializer-legacy:4.18.0'
    implementation 'net.kyori:adventure-text-serializer-gson:4.18.0'
    implementation 'com.github.retrooper:packetevents-spigot:2.7.0'

    // Test dependencies
    testCompileOnly 'org.projectlombok:lombok:1.18.32'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
    annotationProcessor 'org.projectlombok:lombok:1.18.32'

}

java {
    sourceCompatibility = JavaVersion.VERSION_21
    targetCompatibility = JavaVersion.VERSION_21
}

def targetJavaVersion = 21

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8'
    options.release.set(targetJavaVersion)
}

// Configure resource processing
processResources {
    def props = [version: version]
    inputs.properties props
    filteringCharset 'UTF-8'
    filesMatching('.yml') {
        expand props
    }
}

shadowJar {
    relocate 'com.cryptomorin.xseries', 'net.matrixcreations.libs.xseries'
    relocate 'io.papermc.lib', 'net.matrixcreations.libs.paperlib'
    relocate 'net.matrixcreations.worldTemplateAPI', 'net.matrixcreations.libs.templateapi'
    relocate 'dev.jorel.commandapi', 'net.matrixcreations.libs.commandapi'
    relocate 'com.github.retrooper.packetevents', 'net.matrixcreations.libs.packetevents'
    relocate 'net.kyori', 'net.matrixcreations.libs.kyori'
    relocate 'net.megavex.scoreboardlibrary', 'net.matrixcreations.libs.scoreboardlibrary'

    manifest {
        attributes['paperweight-mappings-namespace'] = 'mojang'
    }
}

// Build dependencies
tasks.build.dependsOn(shadowJar)

// Task to export JARs
tasks.register('exportJars') {
    doLast {
        def outputDir = new File('libs')
        outputDir.mkdirs()

        configurations.each { configuration ->
            if (configuration.isCanBeResolved()) {
                configuration.resolvedConfiguration.resolvedArtifacts.each { artifact ->
                    def fileName = "${artifact.moduleVersion.id.group}-${artifact.moduleVersion.id.name}-${artifact.moduleVersion.id.version}.jar"
                    def srcFile = artifact.file
                    def destFile = new File(outputDir, fileName)

                    if (srcFile.exists() && srcFile.name.endsWith('.jar')) {
                        ant.copy(file: srcFile, toFile: destFile)
                        println "Copied: $fileName"
                    }
                }
            }
        }

        println "\nAll JARs have been exported to: ${outputDir.absolutePath}"
    }
}
public class Main extends JavaPlugin implements Listener {
    private ScoreboardLibrary sc;
    private TeamManager teamManager;

    @Override
    public void onEnable() {
        try {
            sc = ScoreboardLibrary.loadScoreboardLibrary(this);
        } catch (NoPacketAdapterAvailableException e) {
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        teamManager = sc.createTeamManager();
        getServer().getPluginManager().registerEvents(this, this);
    }

    @Override
    public void onDisable() {
        teamManager.close();
        sc.close();
    }

    @EventHandler
    public void join(PlayerJoinEvent event) {
        teamManager.addPlayer(event.getPlayer());

        final var team = teamManager.createIfAbsent("what");
        team.defaultDisplay().addEntry(event.getPlayer().getName());
        team.defaultDisplay().prefix(Component.text("[test] "));
    }

    @EventHandler
    public void quit(PlayerJoinEvent event) {
        teamManager.addPlayer(event.getPlayer());
    }
}

I would need more info about your environment to reproduce error error.

Uh I use dynamic plugin loader like https://github.com/AkramLZ/PluginLoader

@vytskalt
Copy link
Collaborator

vytskalt commented Jan 2, 2025

Perhaps you should ask the devs of the loader then because the provided build.gradle works fine. Otherwise I need a minimal reproduction example that gets that error

@ItsHarshXD
Copy link
Author

Perhaps you should ask the devs of the loader then because the provided build.gradle works fine. Otherwise I need a minimal reproduction example that gets that error

I don't think so... see this error comes after i edited my build.gradle:

[02:47:34 WARN]: [CivilizationRoyale] Plugin CivilizationRoyale vBuild 1a generated an exception while executing task 440
java.lang.NoClassDefFoundError: net/matrixcreations/libs/kyori/adventure/text/serializer/gson/GsonComponentSerializer
        at net.matrixcreations.libs.scoreboardlibrary.implementation.packetAdapter.modern.ComponentProviderImpl.fromAdventure(ComponentProviderImpl.java:64) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.packetAdapter.modern.objective.SpigotObjectivePacketAdapter.lambda$sendProperties$1(SpigotObjectivePacketAdapter.java:43) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.packetAdapter.util.LocalePacketUtil.sendLocalePackets(LocalePacketUtil.java:29) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.packetAdapter.modern.objective.SpigotObjectivePacketAdapter.sendProperties(SpigotObjectivePacketAdapter.java:38) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.sidebar.AbstractSidebar.display(AbstractSidebar.java:171) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.player.DisplayableQueue.add(DisplayableQueue.java:38) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.sidebar.AbstractSidebar.tick(AbstractSidebar.java:198) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.sidebar.SidebarUpdaterTask.run(SidebarUpdaterTask.java:36) ~[?:?]
        at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:78) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[paper-1.21.4.jar:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.ClassNotFoundException: net.matrixcreations.libs.kyori.adventure.text.serializer.gson.GsonComponentSerializer
        at java.base/java.lang.ClassLoader.findClass(ClassLoader.java:733) ~[?:?]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593) ~[?:?]
        at Loader-BattleRoyale-1.0-SNAPSHOT.jar-out (3).jar/me.athishh.seraphim.ClassLoader.loadClass(ClassLoader.java:89) ~[Loader-BattleRoyale-1.0-SNAPSHOT.jar-out (3).jar:?]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
        ... 14 more

New Build.gradle:

plugins {
    id 'java'
    id 'com.gradleup.shadow' version '8.3.5'
    id 'maven-publish'
}

group = 'net.matrixcreations'
version = '1.0.4'

def scoreboardLibraryVersion = "2.2.2"

repositories {
    mavenCentral()
    maven { url 'https://repo.papermc.io/repository/maven-public/' }
    maven { url 'https://papermc.io/repo/repository/maven-public/' }
    maven { url 'https://oss.sonatype.org/content/groups/public/' }
    maven { url 'https://jitpack.io' }
    maven { url 'https://repo.nexomc.com/releases' }
    maven { url 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
    maven { url uri('https://repo.codemc.org/repository/maven-public/') }
    maven { url uri('https://repo.onarandombox.com/content/groups/public/') }
    maven { url 'https://repo.dmulloy2.net/repository/public/' }
    maven { url 'https://repo.infernalsuite.com/repository/maven-snapshots/' }
    maven { url 'https://repo.rapture.pw/repository/maven-releases/' }
    maven { url 'https://repo.lushplugins.org/releases/' }
    maven { url = 'https://maven.maxhenkel.de/repository/public' }
}

dependencies {
    shadow localGroovy()
    shadow gradleApi()

    // Compile-only dependencies
    compileOnly 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT'
    compileOnly 'org.projectlombok:lombok:1.18.32'
    compileOnly 'org.graalvm.sdk:nativeimage:24.1.1'
    compileOnly 'com.mojang:authlib:1.5.25'
    compileOnly 'com.nexomc:nexo:0.4.0'
    compileOnly 'com.github.LoneDev6:API-ItemsAdder:3.6.3-beta-14'
    compileOnly 'me.clip:placeholderapi:2.11.6'
    compileOnly files('MatrixGlidersAPI Build 2a.jar')
    compileOnly files('LoaderAPI.jar')
    compileOnly files('SCore-5.24.12.8.jar')
    compileOnly 'com.onarandombox.multiversecore:multiverse-core:4.3.12'
    compileOnly 'com.arcaniax:HeadDatabase-API:1.3.2'

    // Implementation dependencies
    implementation files('api-2.0.0.jar')
    implementation files('advancedslot-4.1.13.2.jar')
    implementation files('configurablegui-4.1.13.2.jar')
    implementation files('core-4.1.13.2.jar')
    implementation files('pagination-4.1.13.2.jar')
    implementation "de.maxhenkel.voicechat:voicechat-api:2.5.27"
    implementation "dev.jorel:commandapi-bukkit-shade-mojang-mapped:9.7.0"
    implementation 'org.graalvm.sdk:graal-sdk:24.1.1'
    implementation 'com.mchange:c3p0:0.10.1'
    implementation 'com.github.cryptomorin:XSeries:12.1.0'
    implementation 'com.github.ItsHarshXD:WorldTemplateAPI:1.0.1'
    implementation 'com.github.retrooper:packetevents-spigot:2.7.0'
    implementation "net.megavex:scoreboard-library-api:$scoreboardLibraryVersion"
    runtimeOnly "net.megavex:scoreboard-library-implementation:$scoreboardLibraryVersion"
    runtimeOnly "net.megavex:scoreboard-library-modern:$scoreboardLibraryVersion:mojmap"
    implementation 'net.kyori:adventure-api:4.18.0'
    implementation 'net.kyori:adventure-text-minimessage:4.18.0'
    implementation 'net.kyori:adventure-text-serializer-legacy:4.18.0'

    // Test dependencies
    testCompileOnly 'org.projectlombok:lombok:1.18.32'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
    annotationProcessor 'org.projectlombok:lombok:1.18.32'
}

java {
    sourceCompatibility = JavaVersion.VERSION_21
    targetCompatibility = JavaVersion.VERSION_21
}

def targetJavaVersion = 21

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8'
    options.release.set(targetJavaVersion)
}

// Configure resource processing
processResources {
    def props = [version: version]
    inputs.properties props
    filteringCharset 'UTF-8'
    filesMatching('.yml') {
        expand props
    }
}

shadowJar {
    manifest {
        attributes['paperweight-mappings-namespace'] = 'mojang'
    }

    relocate 'com.cryptomorin.xseries', 'net.matrixcreations.libs.xseries'
    relocate 'net.matrixcreations.worldTemplateAPI', 'net.matrixcreations.libs.templateapi'
    relocate 'dev.jorel.commandapi', 'net.matrixcreations.libs.commandapi'
    relocate 'net.kyori', 'net.matrixcreations.libs.kyori'
    relocate 'net.megavex.scoreboardlibrary', 'net.matrixcreations.libs.scoreboardlibrary'
}

// Build dependencies
tasks.build.dependsOn(shadowJar)

// Task to export JARs
tasks.register('exportJars') {
    doLast {
        def outputDir = new File('libs')
        outputDir.mkdirs()

        configurations.each { configuration ->
            if (configuration.isCanBeResolved()) {
                configuration.resolvedConfiguration.resolvedArtifacts.each { artifact ->
                    def fileName = "${artifact.moduleVersion.id.group}-${artifact.moduleVersion.id.name}-${artifact.moduleVersion.id.version}.jar"
                    def srcFile = artifact.file
                    def destFile = new File(outputDir, fileName)

                    if (srcFile.exists() && srcFile.name.endsWith('.jar')) {
                        ant.copy(file: srcFile, toFile: destFile)
                        println "Copied: $fileName"
                    }
                }
            }
        }

        println "\nAll JARs have been exported to: ${outputDir.absolutePath}"
    }
}

// Publishing configuration
publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java  // Publish the main Java component
        }
    }
    repositories {
        maven {
            url = uri("${System.getProperty('user.home')}/.m2/repository")
        }
    }
}

After including the gson depend of adventure this error comes:

[03:02:21 ERROR]: Error occurred while enabling CivilizationRoyale vBuild 1a (Is it up to date?)
java.lang.RuntimeException: failed to load scoreboard-library implementation
        at net.matrixcreations.libs.scoreboardlibrary.api.ScoreboardLibrary.loadScoreboardLibrary(ScoreboardLibrary.java:49) ~[?:?]
        at net.matrixcreations.civilizationroyale.CivilizationRoyale.startSystems(CivilizationRoyale.java:284) ~[?:?]
        at net.matrixcreations.civilizationroyale.CivilizationRoyale.onMiniGameEnable(CivilizationRoyale.java:177) ~[?:?]
        at pl.timsixth.minigameapi.api.MiniGame.onEnable(MiniGame.java:107) ~[?:?]
        at Loader-BattleRoyale-1.0-SNAPSHOT.jar-out (3).jar/me.athishh.seraphim.Loader.onEnable(Loader.java:73) ~[Loader-BattleRoyale-1.0-SNAPSHOT.jar-out (3).jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:288) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:520) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:655) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:604) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:743) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:488) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:322) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:310) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.api.ScoreboardLibrary.loadScoreboardLibrary(ScoreboardLibrary.java:40) ~[?:?]
        ... 16 more
Caused by: java.lang.RuntimeException: couldn't initialize packet adapter
        at net.matrixcreations.libs.scoreboardlibrary.implementation.PacketAdapterLoader.loadPacketAdapter(PacketAdapterLoader.java:28) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.ScoreboardLibraryImpl.<init>(ScoreboardLibraryImpl.java:62) ~[?:?]
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.api.ScoreboardLibrary.loadScoreboardLibrary(ScoreboardLibrary.java:40) ~[?:?]
        ... 16 more
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.PacketAdapterLoader.loadPacketAdapter(PacketAdapterLoader.java:26) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.ScoreboardLibraryImpl.<init>(ScoreboardLibraryImpl.java:62) ~[?:?]
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.api.ScoreboardLibrary.loadScoreboardLibrary(ScoreboardLibrary.java:40) ~[?:?]
        ... 16 more
Caused by: java.lang.ExceptionInInitializerError: failed to find chat component fromJson method
        at net.matrixcreations.libs.scoreboardlibrary.implementation.packetAdapter.modern.ComponentProviderImpl.<clinit>(ComponentProviderImpl.java:41) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.packetAdapter.modern.PacketAdapterProviderImpl.<init>(PacketAdapterProviderImpl.java:36) ~[?:?]
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.PacketAdapterLoader.loadPacketAdapter(PacketAdapterLoader.java:26) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.implementation.ScoreboardLibraryImpl.<init>(ScoreboardLibraryImpl.java:62) ~[?:?]
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[?:?]
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.api.ScoreboardLibrary.loadScoreboardLibrary(ScoreboardLibrary.java:40) ~[?:?]
        ... 16 more

This is saying that no net.minecraft.network.chat.Component...

@vytskalt
Copy link
Collaborator

vytskalt commented Jan 3, 2025

Try to replace

implementation 'net.kyori:adventure-api:4.18.0'
implementation 'net.kyori:adventure-text-minimessage:4.18.0'
implementation 'net.kyori:adventure-text-serializer-legacy:4.18.0'
implementation 'net.kyori:adventure-text-serializer-gson:4.18.0'

with:

implementation 'net.kyori:adventure-platform-bukkit:4.0.1'

If it still doesn't work then provide me with the PaperMC build you're using and your Java version details (java --version)

@ItsHarshXD
Copy link
Author

Try to replace

implementation 'net.kyori:adventure-api:4.18.0'
implementation 'net.kyori:adventure-text-minimessage:4.18.0'
implementation 'net.kyori:adventure-text-serializer-legacy:4.18.0'
implementation 'net.kyori:adventure-text-serializer-gson:4.18.0'

with:

implementation 'net.kyori:adventure-platform-bukkit:4.0.1'

If it still doesn't work then provide me with the PaperMC build you're using and your Java version details (java --version)

[11:49:53 ERROR]: Error occurred while enabling CivilizationRoyale vBuild 1a (Is it up to date?)
java.lang.NoClassDefFoundError: net/matrixcreations/libs/kyori/adventure/text/minimessage/MiniMessage
        at net.matrixcreations.civilizationroyale.managers.scoreboards.GameBoardManager.<init>(GameBoardManager.java:30) ~[?:?]
        at net.matrixcreations.civilizationroyale.CivilizationRoyale.startSystems(CivilizationRoyale.java:285) ~[?:?]
        at net.matrixcreations.civilizationroyale.CivilizationRoyale.onMiniGameEnable(CivilizationRoyale.java:176) ~[?:?]
        at pl.timsixth.minigameapi.api.MiniGame.onEnable(MiniGame.java:107) ~[?:?]
        at Loader-BattleRoyale-1.0-SNAPSHOT.jar-out (3).jar/me.athishh.seraphim.Loader.onEnable(Loader.java:73) ~[Loader-BattleRoyale-1.0-SNAPSHOT.jar-out (3).jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:288) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:520) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:655) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:604) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:743) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:488) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:322) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:310) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.ClassNotFoundException: net.matrixcreations.libs.kyori.adventure.text.minimessage.MiniMessage
        at java.base/java.lang.ClassLoader.findClass(ClassLoader.java:733) ~[?:?]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593) ~[?:?]
        at Loader-BattleRoyale-1.0-SNAPSHOT.jar-out (3).jar/me.athishh.seraphim.ClassLoader.loadClass(ClassLoader.java:89) ~[Loader-BattleRoyale-1.0-SNAPSHOT.jar-out (3).jar:?]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
        ... 17 more

Do the adventure needs to be shaded?

@vytskalt
Copy link
Collaborator

vytskalt commented Jan 3, 2025

If you're using Paper then no

@ItsHarshXD
Copy link
Author

If you're using Paper then no

This error is coming now:

[12:22:42 ERROR]: Could not pass event PlayerJoinEvent to CivilizationRoyale vBuild 1a
java.lang.LinkageError: loader constraint violation: when resolving interface method 'net.kyori.adventure.text.Component net.kyori.adventure.text.minimessage.MiniMessage.deserialize(java.lang.Object)' the class loader me.athishh.seraphim.ClassLoader @287449bd of the current class, net/matrixcreations/civilizationroyale/managers/scoreboards/GameBoardManager, and the class loader java.net.URLClassLoader @41cf53f9 for the method's defining class, net/kyori/adventure/text/minimessage/MiniMessage, have different Class objects for the type net/kyori/adventure/text/Component used in the signature (net.matrixcreations.civilizationroyale.managers.scoreboards.GameBoardManager is in unnamed module of loader me.athishh.seraphim.ClassLoader @287449bd, parent loader 'Loader-BattleRoyale-1.0-SNAPSHOT.jar-out (3).jar' @7c524649; net.kyori.adventure.text.minimessage.MiniMessage is in unnamed module of loader java.net.URLClassLoader @41cf53f9, parent loader 'platform')
        at net.matrixcreations.civilizationroyale.managers.scoreboards.GameBoardManager.processText(GameBoardManager.java:49) ~[?:?]
        at net.matrixcreations.civilizationroyale.managers.scoreboards.GameBoardManager.lambda$showScoreboard$0(GameBoardManager.java:93) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.api.sidebar.component.SidebarComponent.lambda$dynamicLine$3(SidebarComponent.java:32) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.api.sidebar.component.ComponentSidebarLayout.apply(ComponentSidebarLayout.java:45) ~[?:?]
        at net.matrixcreations.civilizationroyale.managers.scoreboards.GameBoardManager.showScoreboard(GameBoardManager.java:113) ~[?:?]
        at me.athishh.profiles.Profile.setState(Profile.java:122) ~[?:?]
        at me.athishh.profiles.listener.ProfileListener.onPlayerJoin(ProfileListener.java:57) ~[?:?]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
        at net.minecraft.server.players.PlayerList.placeNewPlayer(PlayerList.java:327) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.network.ServerConfigurationPacketListenerImpl.handleConfigurationFinished(ServerConfigurationPacketListenerImpl.java:163) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.network.protocol.configuration.ServerboundFinishConfigurationPacket.handle(ServerboundFinishConfigurationPacket.java:22) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.network.protocol.configuration.ServerboundFinishConfigurationPacket.handle(ServerboundFinishConfigurationPacket.java:8) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:29) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:155) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1448) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:176) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:129) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1428) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1422) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:139) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.managedBlock(MinecraftServer.java:1379) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1387) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1264) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:310) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]

@vytskalt
Copy link
Collaborator

vytskalt commented Jan 3, 2025

Also remove the relocate 'net.kyori', 'net.matrixcreations.libs.kyori' line
and implementation 'net.kyori:adventure-platform-bukkit:4.0.1' if you haven't already

@ItsHarshXD
Copy link
Author

Also remove the relocate 'net.kyori', 'net.matrixcreations.libs.kyori' line and implementation 'net.kyori:adventure-platform-bukkit:4.0.1' if you haven't already

Currently: I'm not shading adventure into my project.

You mean i need to remove adventure implementation from my project?

@vytskalt
Copy link
Collaborator

vytskalt commented Jan 3, 2025

Yes, paper has adventure built in

@ItsHarshXD
Copy link
Author

Yes, paper has adventure built in

Still new error:

[03:06:38 ERROR]: Could not pass event PlayerJoinEvent to CivilizationRoyale vBuild 1a
java.lang.LinkageError: loader constraint violation: when resolving interface method 'net.kyori.adventure.text.Component net.kyori.adventure.text.minimessage.MiniMessage.deserialize(java.lang.Object)' the class loader me.athishh.seraphim.ClassLoader @4295ed06 of the current class, net/matrixcreations/civilizationroyale/managers/scoreboards/GameBoardManager, and the class loader java.net.URLClassLoader @41cf53f9 for the method's defining class, net/kyori/adventure/text/minimessage/MiniMessage, have different Class objects for the type net/kyori/adventure/text/Component used in the signature (net.matrixcreations.civilizationroyale.managers.scoreboards.GameBoardManager is in unnamed module of loader me.athishh.seraphim.ClassLoader @4295ed06, parent loader 'Loader-BattleRoyale-1.0-SNAPSHOT.jar-out (3).jar' @613dcbef; net.kyori.adventure.text.minimessage.MiniMessage is in unnamed module of loader java.net.URLClassLoader @41cf53f9, parent loader 'platform')
        at net.matrixcreations.civilizationroyale.managers.scoreboards.GameBoardManager.processText(GameBoardManager.java:49) ~[?:?]
        at net.matrixcreations.civilizationroyale.managers.scoreboards.GameBoardManager.lambda$showScoreboard$0(GameBoardManager.java:93) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.api.sidebar.component.SidebarComponent.lambda$dynamicLine$3(SidebarComponent.java:32) ~[?:?]
        at net.matrixcreations.libs.scoreboardlibrary.api.sidebar.component.ComponentSidebarLayout.apply(ComponentSidebarLayout.java:45) ~[?:?]
        at net.matrixcreations.civilizationroyale.managers.scoreboards.GameBoardManager.showScoreboard(GameBoardManager.java:113) ~[?:?]
        at me.athishh.profiles.Profile.setState(Profile.java:122) ~[?:?]
        at me.athishh.profiles.listener.ProfileListener.onPlayerJoin(ProfileListener.java:57) ~[?:?]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
        at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
        at net.minecraft.server.players.PlayerList.placeNewPlayer(PlayerList.java:327) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.network.ServerConfigurationPacketListenerImpl.handleConfigurationFinished(ServerConfigurationPacketListenerImpl.java:163) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.network.protocol.configuration.ServerboundFinishConfigurationPacket.handle(ServerboundFinishConfigurationPacket.java:22) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.network.protocol.configuration.ServerboundFinishConfigurationPacket.handle(ServerboundFinishConfigurationPacket.java:8) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:29) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:155) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1448) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:176) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:129) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1428) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1422) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:139) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.managedBlock(MinecraftServer.java:1379) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1387) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1264) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:310) ~[paper-1.21.4.jar:1.21.4-71-83995d7e]
        at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]

@vytskalt
Copy link
Collaborator

vytskalt commented Jan 4, 2025

If I had to guess one of your dependencies are causing adventure to still be shaded into your plugin.jar and it's conflicting with Paper's built-in adventure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants