import org.apache.tools.ant.filters.ReplaceTokens

plugins {
    id 'java'
    id 'com.gradleup.shadow' version '9.0.0-rc1'
    id 'net.ltgt.errorprone' version '4.1.0'
}

repositories {
    mavenLocal()
    mavenCentral()

    maven {
        url = uri('https://repo.maven.apache.org/maven2/')
    }

    // Spigot
    maven {
        url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/')
    }

    maven {
        url = uri('https://repo.codemc.org/repository/maven-public')
    }

}

dependencies {
    compileOnly 'org.jetbrains:annotations:26.0.2'

    compileOnly 'org.spigotmc:spigot-api:1.21.8-R0.1-SNAPSHOT'
    implementation 'org.bstats:bstats-bukkit:3.1.0'

    compileOnly group: "net.dmulloy2", name: "ProtocolLib", version: "5.4.0"

    errorprone("com.google.errorprone:error_prone_core:2.40.0")
}

group = 'de.flo56958'
version = '2.0'
description = 'A TinkersConstruct (and other mods) inspired spigot server plugin'
java.sourceCompatibility = JavaVersion.VERSION_21

jar.dependsOn(processResources)
assemble.dependsOn(shadowJar)

shadowJar {
    relocate('org.bstats', 'de.flo56958.minetinker.bStats')
    archiveFileName = "MineTinker.jar"
}

compileJava {
	options.encoding = 'UTF-8'

    options.deprecation = true

    options.errorprone.disable('MissingSummary', 'UnusedMethod')
    options.errorprone.error(
            'NonCanonicalType', 'JdkObsolete', 'MissingOverride',
            'UnnecessaryParentheses', 'OperatorPrecedence')
}

processResources {
    filteringCharset = 'UTF-8'
    filter ReplaceTokens, tokens: [
            "project.version"    : project.version,
            "project.url"        : "https://github.com/Flo56958/MineTinker",
            "project.description": project.description
    ]
}
