buildscript {
    repositories {
        maven { url = 'https://maven.minecraftforge.net' }
        mavenCentral()
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+'
    }
}

/*
plugins {
    id 'eclipse'
    id 'maven-publish'
    id 'net.minecraftforge.gradle'
}
*/
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '1.0'
group = 'minecraft_mod_player_statistics'
archivesBaseName = 'playerstats'

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

minecraft {
    mappings channel: 'official', version: '1.18.2'
    runs {
        client {
            workingDirectory project.file('run')
            property 'forge.logging.markers', 'REGISTRIES'
            property 'forge.logging.console.level', 'debug'
            mods {
                playerstats {
                    source sourceSets.main
                }
            }
        }
        server {
            workingDirectory project.file('run')
            property 'forge.logging.markers', 'REGISTRIES'
            property 'forge.logging.console.level', 'debug'
            mods {
                playerstats {
                    source sourceSets.main
                }
            }
        }
    }
}

dependencies {
    /* Project */
    minecraft 'net.minecraftforge:forge:1.18.2-40.1.0'
    implementation 'mysql:mysql-connector-java:8.0.27'

    /* Tests */
    // Unit
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
    testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
    testImplementation 'org.mockito:mockito-core:4.3.1'
    testImplementation 'org.mockito:mockito-junit-jupiter:4.3.1'
    // Integration
    // testImplementation 'net.minecraftforge:forge:1.18.2-40.1.0:test'
}

jar {
    manifest {
        attributes([
            "Specification-Title": "playerstats",
            "Specification-Vendor": "examplemodsareus",
            "Specification-Version": "1",
            "Implementation-Title": project.name,
            "Implementation-Version": project.jar.archiveVersion,
            "Implementation-Vendor" :"examplemodsareus",
            "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
        ])
    }
}

test {
    useJUnitPlatform()
    testLogging {
        events "passed", "skipped", "failed"
    }
}
