import java.io.ByteArrayOutputStream import java.io.FileOutputStream import java.net.URL import net.minecrell.pluginyml.bukkit.BukkitPluginDescription plugins { id("java") id("java-library") id("net.minecrell.plugin-yml.bukkit") version "0.5.1" id("xyz.jpenilla.run-paper") version "1.0.6" id("maven-publish") } group = "com.alttd.playershops" version = System.getenv("BUILD_NUMBER") ?: "1.0-SNAPSHOT" description = "Player Shop plugin for Altitude." apply() apply(plugin = "maven-publish") java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } } tasks { withType { options.encoding = Charsets.UTF_8.name() } withType { options.encoding = Charsets.UTF_8.name() } runServer { // runDirectory.set(File("./run1")) val fileName = "./run/galaxy.jar" var file = File(fileName) if (!file.parentFile.exists()) { file.parentFile.mkdirs() } if (!file.exists()) { download("https://repo.destro.xyz/snapshots/com/alttd/Galaxy-Server/Galaxy-paperclip-1.19.2-R0.1-SNAPSHOT-reobf.jar", fileName) } serverJar(file) minecraftVersion("1.19.2") } jar { archiveFileName.set("${rootProject.name}.jar") } } publishing { publications { create("mavenJava") { from(components["java"]) } } configure { repositories { maven { name = "maven" url = uri("https://repo.destro.xyz/snapshots/") credentials(PasswordCredentials::class) } } } } dependencies { compileOnly("com.alttd:Galaxy-API:1.19.2-R0.1-SNAPSHOT") compileOnly("com.github.milkbowl:VaultAPI:1.7") { exclude("org.bukkit","bukkit") } compileOnly("com.github.TechFortress:GriefPrevention:16.17.1") compileOnly("org.projectlombok:lombok:1.18.24") annotationProcessor("org.projectlombok:lombok:1.18.24") } fun gitCommit(): String { val os = ByteArrayOutputStream() project.exec { commandLine = "git rev-parse --short HEAD".split(" ") standardOutput = os } return String(os.toByteArray()).trim() } fun download(link: String, path: String) { URL(link).openStream().use { input -> FileOutputStream(File(path)).use { output -> input.copyTo(output) } } } bukkit { name = rootProject.name main = "$group.${rootProject.name}" version = "${rootProject.version}-${gitCommit()}" apiVersion = "1.19" authors = listOf("destro174") depend = listOf("Vault", "GriefPrevention") commands { register("playershop") { description = "This is a test command!" aliases = listOf("shop") permission = "playershops.command.playershop" } } permissions { register("playershops.admin") { description = "Admin permission for the ${rootProject.name} plugin." default = BukkitPluginDescription.Permission.Default.FALSE children = listOf( "playershops.shop.create", "playershops.shop.break.other", "playershops.shop.open.other", "playershops.shop.use", "playershops.shop.use.buy", "playershops.shop.use.sell", "playershops.shop.use.gamble" ) } 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 children = listOf( "playershops.shop.break", ) } register("playershops.shop.open.other") { description = "Allows players to open other players shops." default = BukkitPluginDescription.Permission.Default.FALSE } 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", "playershops.shop.use.gamble" ) } 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 } register("playershops.shop.use.gamble") { description = "Allows players to use gamble playershops." default = BukkitPluginDescription.Permission.Default.FALSE } } }