import org.spongepowered.gradle.plugin.config.PluginLoaders
import org.spongepowered.gradle.vanilla.repository.MinecraftPlatform

plugins {
    id "org.spongepowered.gradle.plugin" version "2.2.0"
    id "org.spongepowered.gradle.vanilla" version "0.2.1-SNAPSHOT"
}

dependencies {
    implementation project(":api")
    implementation project(":common")

    shadow "net.playeranalytics:platform-abstraction-layer-api:$palVersion"
    shadow "net.playeranalytics:platform-abstraction-layer-sponge:$palVersion"
    shadow "org.bstats:bstats-sponge:$bstatsVersion"

    annotationProcessor "org.spongepowered:spongeapi:$spongeVersion"
    compileOnly "org.spongepowered:mixin:0.8.5"

    testImplementation "org.spongepowered:spongeapi:$spongeVersion"
    testImplementation project(path: ":common", configuration: 'testArtifacts')
}

sponge {
    apiVersion(spongeVersion)
    license("LGPLv3")
    loader {
        name(PluginLoaders.JAVA_PLAIN)
        version("1.0")
    }
    plugin("plan") {
        displayName("Plan")
        version(fullVersion)
        entrypoint("com.djrapitops.plan.PlanSponge")
        description("Player Analytics Plugin by AuroraLS3")
        contributor("AuroraLS3") {
            description("Author")
        }

        dependency("spongeapi") {
            loadOrder(org.spongepowered.plugin.metadata.model.PluginDependency.LoadOrder.AFTER)
            optional(false)
            version("$spongeVersion")
        }
        // Dependencies
        // version is a *required* property (empty string works fine)
        dependency("griefprevention") {
            optional(true)
            version("*")
        }
        dependency("luckperms") {
            optional(true)
            version("*")
        }
        dependency("nucleus") {
            optional(true)
            version("*")
        }
        dependency("redprotect") {
            optional(true)
            version("*")
        }
        dependency("nuvotifier") {
            optional(true)
            version("*")
        }
    }
}

minecraft {
    version("1.16.5")
    platform(MinecraftPlatform.JOINED)
}

compileJava {
    options.release = 11
}

shadowJar {
    configurations = [project.configurations.shadow]

    relocate "org.bstats", "net.playeranalytics.bstats.utilities.metrics"
}
