Plugin not working and showing as non-mod

Seems like you have kicked out all dependencies of sponge. Mind showing your updated build.gradle file?

import java.util.regex.Pattern.compile

plugins {
    `java-library`
    java
}

group = "idi.nahui"
version = "1.0-SNAPSHOT"

repositories {
    jcenter()
    maven(url = "https://repo.spongepowered.org/maven") {
        name = "sponge-repo"
    }
}

val javaTarget = 8
java {
    sourceCompatibility = JavaVersion.toVersion(javaTarget)
    targetCompatibility = JavaVersion.toVersion(javaTarget)
    if (JavaVersion.current() < JavaVersion.toVersion(javaTarget)) {
        toolchain.languageVersion.set(JavaLanguageVersion.of(javaTarget))
    }
}

dependencies {
    compile("org.spongepowered:spongeapi:7.4.0")
}

By the way, I’m wondering why, when automatically building a project in intellij idea, the build.gradle file is in .kts format. That is, for most it is simply called “build.gradle”, but for me it is written in Kotlin and is called “build.gradle.kts”

The build.gralde question.

The old style of gradle only supported the groovy language. However more modern versions of gradle also support the kotlin language. The way gradle works out what language to use is by the .kts.

as for the gradle file. I didnt realise you were using the kts version. Here is one that works for me

plugins {
    `java-library`
}

group = "idi.nahui"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
    maven("https://repo.spongepowered.org/maven")
}

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

dependencies {
    implementation("org.spongepowered:spongeapi:7.4.0")
}

1 Like

Hooray! Thank you very much! Finally I can use commands like “getCommandManager” and so on.
By the way, you are like a superhero on this forum, because when I used to look for answers to questions, in most cases the answer was from you. Again, thank you very much!

1 Like

Your welcome. Glad i can help