PlayerShops/build.gradle.kts

168 lines
5.3 KiB
Plaintext
Raw Permalink Normal View History

import java.io.ByteArrayOutputStream
2022-08-13 13:22:00 +00:00
import java.io.FileOutputStream
import java.net.URL
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
plugins {
id("java")
2022-09-11 08:57:29 +00:00
id("java-library")
2023-06-27 14:32:30 +00:00
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
2022-08-13 13:22:00 +00:00
id("xyz.jpenilla.run-paper") version "1.0.6"
2022-09-11 08:57:29 +00:00
id("maven-publish")
}
2022-08-13 13:22:00 +00:00
group = "com.alttd.playershops"
2025-06-15 07:01:19 +00:00
version = System.getenv("BUILD_NUMBER") ?: "1.3-SNAPSHOT"
2022-08-13 13:22:00 +00:00
description = "Player Shop plugin for Altitude."
2022-08-13 13:22:00 +00:00
apply<JavaLibraryPlugin>()
2022-09-11 08:57:29 +00:00
apply(plugin = "maven-publish")
2022-08-13 13:22:00 +00:00
java {
toolchain {
2024-07-20 14:19:57 +00:00
languageVersion.set(JavaLanguageVersion.of(21))
}
2022-08-13 13:22:00 +00:00
}
2022-08-13 13:22:00 +00:00
tasks {
withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name()
}
withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
}
2022-08-13 13:22:00 +00:00
runServer {
2025-06-15 07:01:19 +00:00
val fileName = "./run/cosmos.jar"
2024-07-20 14:19:57 +00:00
val file = File(fileName)
2022-08-13 13:22:00 +00:00
if (!file.parentFile.exists()) {
file.parentFile.mkdirs()
}
if (!file.exists()) {
2025-06-15 07:01:19 +00:00
download("https://jenkins.destro.xyz/job/Cosmos/lastSuccessfulBuild/artifact/cosmos-server/build/libs/cosmos-bundler-1.21.6-R0.1-SNAPSHOT-mojmap.jar", fileName)
2022-07-09 12:53:27 +00:00
}
2022-08-13 13:22:00 +00:00
serverJar(file)
2024-07-20 14:19:57 +00:00
minecraftVersion("1.21")
2022-07-09 12:53:27 +00:00
}
2022-09-26 06:34:42 +00:00
jar {
archiveFileName.set("${rootProject.name}.jar")
}
}
2022-09-11 08:57:29 +00:00
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
configure<PublishingExtension> {
repositories {
maven {
name = "maven"
url = uri("https://repo.destro.xyz/snapshots/")
credentials(PasswordCredentials::class)
}
}
}
}
2022-08-13 13:22:00 +00:00
2022-08-07 15:28:38 +00:00
dependencies {
2025-06-15 07:01:19 +00:00
compileOnly("com.alttd.cosmos:cosmos-api:1.21.6-R0.1-SNAPSHOT")
2022-08-07 15:28:38 +00:00
compileOnly("com.github.milkbowl:VaultAPI:1.7") {
exclude("org.bukkit","bukkit")
}
compileOnly("com.github.TechFortress:GriefPrevention:16.17.1")
2024-07-20 14:19:57 +00:00
compileOnly("org.projectlombok:lombok:1.18.30")
annotationProcessor("org.projectlombok:lombok:1.18.30")
2022-08-07 15:28:38 +00:00
}
fun gitCommit(): String {
val os = ByteArrayOutputStream()
2022-06-07 12:38:30 +00:00
project.exec {
commandLine = "git rev-parse --short HEAD".split(" ")
standardOutput = os
}
return String(os.toByteArray()).trim()
2022-08-07 15:28:38 +00:00
}
2022-08-13 13:22:00 +00:00
fun download(link: String, path: String) {
URL(link).openStream().use { input ->
FileOutputStream(File(path)).use { output ->
input.copyTo(output)
}
}
}
2022-08-07 15:28:38 +00:00
bukkit {
name = rootProject.name
main = "$group.${rootProject.name}"
version = "${rootProject.version}-${gitCommit()}"
2023-06-27 14:32:30 +00:00
apiVersion = "1.20"
2022-08-07 15:28:38 +00:00
authors = listOf("destro174")
2023-06-19 07:36:23 +00:00
depend = listOf("Vault")
softDepend = listOf("GriefPrevention")
2022-08-13 13:22:00 +00:00
permissions {
register("playershops.admin") {
description = "Admin permission for the ${rootProject.name} plugin."
default = BukkitPluginDescription.Permission.Default.FALSE
2022-08-21 22:21:36 +00:00
children = listOf(
"playershops.shop.create",
"playershops.shop.break.other",
2022-09-26 06:32:19 +00:00
"playershops.shop.open.other",
2022-08-23 21:41:00 +00:00
"playershops.shop.use",
"playershops.shop.use.buy",
"playershops.shop.use.sell",
2024-08-16 19:21:50 +00:00
"playershops.shop.use.random"
2022-08-21 22:21:36 +00:00
)
2022-08-13 13:22:00 +00:00
}
register("playershops.shoplimit") {
description = "Base permission to allow per player shop limits."
default = BukkitPluginDescription.Permission.Default.FALSE
}
register("playershops.shop.create") {
description = "Allows players to create shops."
default = BukkitPluginDescription.Permission.Default.FALSE
}
register("playershops.shop.break") {
description = "Allows players to break shops."
default = BukkitPluginDescription.Permission.Default.FALSE
}
register("playershops.shop.break.other") {
description = "Allows players to break other players shops."
default = BukkitPluginDescription.Permission.Default.FALSE
2022-08-21 22:21:36 +00:00
children = listOf(
"playershops.shop.break",
)
}
2022-09-26 06:32:19 +00:00
register("playershops.shop.open.other") {
description = "Allows players to open other players shops."
default = BukkitPluginDescription.Permission.Default.FALSE
}
2022-08-21 22:21:36 +00:00
register("playershops.shop.use") {
description = "Allows players to use all playershops."
default = BukkitPluginDescription.Permission.Default.FALSE
children = listOf(
"playershops.shop.use.buy",
"playershops.shop.use.sell",
2024-08-16 19:21:50 +00:00
"playershops.shop.use.random"
2022-08-21 22:21:36 +00:00
)
}
register("playershops.shop.use.buy") {
description = "Allows players to use buying playershops."
default = BukkitPluginDescription.Permission.Default.FALSE
}
register("playershops.shop.use.sell") {
description = "Allows players to use selling playershops."
default = BukkitPluginDescription.Permission.Default.FALSE
}
2024-08-16 19:21:50 +00:00
register("playershops.shop.use.random") {
description = "Allows players to use random playershops."
2022-08-21 22:21:36 +00:00
default = BukkitPluginDescription.Permission.Default.FALSE
2022-08-13 13:22:00 +00:00
}
}
}