plugins { id 'java' id 'maven-publish' id 'idea' id 'checkstyle' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'net.minecrell.plugin-yml.bukkit' version '0.5.1' } repositories { mavenLocal() gradlePluginPortal() maven { url = uri('https://jitpack.io') content { includeGroup('com.github.vexsoftware') } } maven { url = uri('https://nexus.hc.to/content/repositories/pub_releases/') content { includeGroup('net.milkbowl.vault') } } maven { url = uri("https://papermc.io/repo/repository/maven-public/") } maven { url = uri('https://repo.codemc.org/repository/maven-public/') } maven { url = uri('https://repo.codemc.org/repository/nms/') content { includeGroup('org.spigotmc') } } maven { url = uri('https://hub.spigotmc.org/nexus/content/groups/public/') } maven { url = uri('https://maven.enginehub.org/repo/') } maven { url = uri('https://maven.elmakers.com/repository/') } maven { url = uri('https://m2.dv8tion.net/releases/') content { includeGroup('net.dv8tion') includeGroup('club.minnced') includeGroup('com.google.code') includeGroup('com.neovisionaries') includeGroup('com.squareup') includeGroup('org.apache.commons') includeGroup('org.jetbrains.annotations') includeGroup('org.slf4j.slf4j-api') } } maven { url = uri('https://maven.playpro.com/') content { includeGroup('net.coreprotect') } } maven { url = uri('https://nexus.telesphoreo.me/repository/totalfreedom/') content { includeGroup('me.totalfreedom') } } maven { url = uri('https://repo.mattmalec.com/repository/releases') content { includeGroup('com.mattmalec') } } maven { url = uri('https://repo.essentialsx.net/releases/') content { includeGroup('net.essentialsx') } } mavenCentral() } dependencies { implementation('commons-io:commons-io:2.11.0') implementation('org.apache.commons:commons-lang3:3.12.0') implementation('commons-codec:commons-codec:1.15') implementation('org.bstats:bstats-base:3.0.0') implementation('org.bstats:bstats-bukkit:3.0.0') implementation('org.reflections:reflections:0.10.2') implementation('org.javassist:javassist:3.28.0-GA') implementation('org.jetbrains:annotations:23.0.0') implementation('com.mattmalec:Pterodactyl4J:2.BETA_92') implementation('com.squareup.okhttp3:okhttp:4.9.3') compileOnly('org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT') compileOnly('me.totalfreedom:BukkitTelnet:4.7') compileOnly('me.totalfreedom:TF-LibsDisguises:10.0.27-SNAPSHOT') compileOnly('com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT') compileOnly('net.essentialsx:EssentialsX:2.19.2') compileOnly('net.dv8tion:JDA:4.3.0_277') compileOnly('net.coreprotect:coreprotect:20.4') compileOnly('com.sk89q.worldguard:worldguard-bukkit:7.0.6') compileOnly('com.github.vexsoftware:votifier:v1.9') compileOnly('net.goldtreeservers:worldguardextraflags:4.0.0') compileOnly('me.totalfreedom:TFGuilds:2021.06-RC3') } group = 'me.totalfreedom' version = project.property('project.pluginVersion') description = 'TotalFreedomMod' java.sourceCompatibility = JavaVersion.VERSION_17 java.targetCompatibility = JavaVersion.VERSION_17 archivesBaseName = 'TotalFreedomMod-donotuse' bukkit { main = 'me.totalfreedom.totalfreedommod.TotalFreedomMod' apiVersion = '1.17' version = project.property('project.pluginVersion') description = 'Plugin for the Total Freedom server.' authors = ['Madgeek1450', 'Prozza'] softDepend = ['BukkitTelnet', 'Essentials', 'CoreProtect', 'LibsDisguises', 'WorldEdit', 'WorldGuard', 'WorldGuardExtraFlags', 'TFGuilds', 'JDA', 'Votifier'] } static def getDate() { return new Date().format('MM/dd/yyyy HH:mm') } String getGitHash() { def stdout = new ByteArrayOutputStream() try { exec { commandLine "git", "rev-parse", "--short", "HEAD" standardOutput = stdout ignoreExitValue = true } } catch (GradleException e) { logger.error("Couldn't determine Git head because Git is not installed. " + e.getMessage()) } return stdout.size() > 0 ? stdout.toString().trim() : "unknown" } String getBuildNumber() { def stdout = new ByteArrayOutputStream() try { exec { commandLine "git", "rev-list", "HEAD", "--count" standardOutput = stdout ignoreExitValue = true } } catch (GradleException e) { logger.error("Couldn't determine build number because Git is not installed. " + e.getMessage()) } return stdout.size() > 0 ? stdout.toString().trim() : "unknown" } tasks.withType(Checkstyle) { reports { xml.required = false html.required = true html.stylesheet resources.text.fromFile('config/xsl/checkstyle.xsl') } } task buildProperties { ant.propertyfile(file: "$project.rootDir/src/main/resources/build.properties") { entry(key: "buildAuthor", default: "unknown") entry(key: "buildNumber", value: getBuildNumber()) entry(key: "buildDate", value: getDate()) entry(key: "buildCodeName", value: project.property('project.buildCodeName')) entry(key: "buildHead", value: getGitHash()) } } shadowJar { shadowJar { archiveBaseName.set('TotalFreedomMod') archiveClassifier.set('') archiveVersion.set('') } minimize() dependencies { include(dependency('commons-io:commons-io')) include(dependency('org.apache.commons:commons-lang3')) include(dependency('commons-codec:commons-codec')) include(dependency('org.javassist:javassist')) include(dependency('io.papermc:paperlib')) include(dependency('org.bstats:bstats-base')) include(dependency('org.bstats:bstats-bukkit')) include(dependency('org.reflections:reflections')) include(dependency('org.jetbrains:annotations')) include(dependency('com.mattmalec:Pterodactyl4J')) include(dependency('com.squareup:okhttp3')) } relocate 'org.bstats', 'me.totalfreedom.totalfreedommod' relocate 'io.papermc.lib', 'me.totalfreedom.totalfreedommod.paperlib' } tasks.compileJava.finalizedBy tasks.buildProperties tasks.build.dependsOn tasks.shadowJar publishing { publications { maven(MavenPublication) { from components.java } } } jar { into("META-INF/maven/$project.group/$project.name") { from { generatePomFileForMavenPublication } rename ".*", "pom.xml" } } tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }