Files
2023-11-26 17:04:56 +01:00

159 lines
5.3 KiB
Kotlin

import java.time.Instant
plugins {
`java-library`
id("com.github.johnrengelman.shadow") version "8.1.1" // Shades and relocates dependencies, See https://imperceptiblethoughts.com/shadow/introduction/
id("xyz.jpenilla.run-paper") version "2.2.2" // Adds runServer and runMojangMappedServer tasks for testing
id("net.minecrell.plugin-yml.bukkit") version "0.6.0" // Automatic plugin.yml generation
eclipse
idea
}
group = "io.github.Alathra"
version = "1.0.0"
description = "Simple collection of commands for the Alathra server."
val mainPackage = "${project.group}.${rootProject.name}"
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(JavaVersion.VERSION_17.majorVersion)) // Configure the java toolchain. This allows gradle to auto-provision JDK 17 on systems that only have JDK 8 installed for example.
}
repositories {
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://mvn-repo.arim.space/lesser-gpl3/")
maven("https://jitpack.io") {
content {
includeGroup("com.github.MilkBowl")
includeGroup("com.github.milkdrinkers")
}
}
maven("https://repo.codemc.org/repository/maven-public/") {
content { includeGroup("dev.jorel") }
}
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") {
content { includeGroup("me.clip") }
}
/* EssentialsX */
// maven("https://repo.essentialsx.net/releases/")
// maven("https://repo.essentialsx.net/snapshots/")
// mavenCentral {
// content { includeGroup("net.kyori") }
// }
}
dependencies {
compileOnly("org.jetbrains:annotations:24.1.0")
annotationProcessor("org.jetbrains:annotations:24.1.0")
compileOnly("io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT")
implementation("space.arim.morepaperlib:morepaperlib:latest.release")
implementation("com.github.milkdrinkers:crate:1.1.0")
implementation("com.github.milkdrinkers:colorparser:2.0.0") {
exclude("net.kyori")
}
implementation("dev.jorel:commandapi-bukkit-shade:9.2.0")
compileOnly("com.github.MilkBowl:VaultAPI:1.7")
compileOnly("me.clip:placeholderapi:2.11.5")
}
tasks {
build {
dependsOn(shadowJar)
}
compileJava {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
// See https://openjdk.java.net/jeps/247 for more information.
options.release.set(17)
options.compilerArgs.addAll(arrayListOf("-Xlint:all", "-Xlint:-processing", "-Xdiags:verbose"))
}
javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
}
processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
}
shadowJar {
archiveBaseName.set(project.name)
archiveClassifier.set("")
// Shadow classes
fun reloc(originPkg: String, targetPkg: String) = relocate(originPkg, "${mainPackage}.lib.${targetPkg}")
reloc("space.arim.morepaperlib", "morepaperlib")
reloc("com.github.milkdrinkers.Crate", "crate")
reloc("com.github.milkdrinkers.colorparser", "colorparser")
reloc("dev.jorel.commandapi", "commandapi")
minimize()
}
runServer {
// Configure the Minecraft version for our task.
minecraftVersion("1.20.2")
// IntelliJ IDEA debugger setup: https://docs.papermc.io/paper/dev/debugging#using-a-remote-debugger
jvmArgs("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005", "-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true", "-DIReallyKnowWhatIAmDoingISwear")
systemProperty("terminal.jline", false)
systemProperty("terminal.ansi", true)
// Automatically install dependencies
downloadPlugins {
// modrinth("carbon", "2.1.0-beta.21")
// github("jpenilla", "MiniMOTD", "v2.0.13", "minimotd-bukkit-2.0.13.jar")
// hangar("squaremap", "1.2.0")
// url("https://download.luckperms.net/1515/bukkit/loader/LuckPerms-Bukkit-5.4.102.jar")
github("MilkBowl", "Vault", "1.7.3", "Vault.jar")
}
}
}
bukkit {
// Plugin main class (required)
main = "${mainPackage}.${rootProject.name}"
// Plugin Information
name = project.name
prefix = project.name
version = "${project.version}"
description = "${project.description}"
authors = listOf("jklmao", "darksaid98")
contributors = listOf()
apiVersion = "1.19"
website = "https://github.com/darksaid98/ClickTpa/"
// Misc properties
load = net.minecrell.pluginyml.bukkit.BukkitPluginDescription.PluginLoadOrder.POSTWORLD // STARTUP or POSTWORLD
depend = listOf()
softDepend = listOf("PlaceholderAPI", "Vault", "Essentials")
}
// Apply custom version arg
val versionArg = if (hasProperty("customVersion"))
(properties["customVersion"] as String).uppercase() // Uppercase version string
else
"${project.version}-SNAPSHOT-${Instant.now().epochSecond}" // Append snapshot to version
// Strip prefixed "v" from version tag
project.version = if (versionArg.first().equals('v', true))
versionArg.substring(1)
else
versionArg.uppercase()