Skip to content

Commit

Permalink
We are now Paper plugin! Also delete a file so that people won't use …
Browse files Browse the repository at this point in the history
…the wrong jar
  • Loading branch information
MATRIX-feather committed Dec 20, 2024
1 parent 391e5b1 commit 3df7e0d
Showing 1 changed file with 57 additions and 22 deletions.
79 changes: 57 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import io.papermc.paperweight.userdev.ReobfArtifactConfiguration
import io.papermc.paperweight.util.path
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
import net.minecrell.pluginyml.paper.PaperPluginDescription

/*
* This file was generated by the Gradle 'init' task.
Expand All @@ -8,9 +10,9 @@ import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
plugins {
java
`maven-publish`
id("net.minecrell.plugin-yml.paper") version "0.6.0" // Generates plugin.yml
id("io.papermc.paperweight.userdev") version "1.7.1"
id("xyz.jpenilla.run-paper") version "2.0.1" // Adds runServer and runMojangMappedServer tasks for testing
id("net.minecrell.plugin-yml.bukkit") version "0.6.0" // Generates plugin.yml
id("io.github.goooler.shadow") version "8.1.7" // Shadow PluginBase
}

Expand Down Expand Up @@ -123,36 +125,52 @@ dependencies {

group = "xyz.nifeather.morph"
version = "${project.property("project_version")}"
description = "A morph plugin that aims to provide many features out-of-the-box"
description = "Yet another disguise plugin, that introduces the morph feature to the server, similar to the MetaMorph mod"
java.sourceCompatibility = JavaVersion.VERSION_21

bukkit {
paper {
load = BukkitPluginDescription.PluginLoadOrder.POSTWORLD
main = "xyz.nifeather.morph.MorphPlugin"
apiVersion = "1.19"
apiVersion = "1.21"
authors = listOf("MATRIX-feather")
depend = listOf()
softDepend = listOf("Towny", "Residence", "ModelEngine", "PlaceholderAPI")
version = "${project.property("project_version")}"
prefix = "FeatherMorph"
name = "FeatherMorph"
foliaSupported = true

commands {
register("morph")
register("morphplayer")
register("unmorph")
serverDependencies {
register("ProtocolLib") {
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
required = false
joinClasspath = true
}

register("request")
register("Residence") {
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
required = false
joinClasspath = true
}

register("play-action")
register("ModelEngine") {
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
required = false
joinClasspath = true
}

register("toggle-town-morph-flight")
register("PlaceholderAPI") {
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
required = false
joinClasspath = true
}

val featherMorphCommand = register("feathermorph").get()
featherMorphCommand.aliases = listOf("fm");
register("Towny") {
load = PaperPluginDescription.RelativeLoadOrder.BEFORE
required = false
joinClasspath = true
}
}

version = "${project.property("project_version")}"
prefix = "FeatherMorph"
name = "FeatherMorph"
foliaSupported = true

val permissionRoot = "feathermorph."

permissions {
Expand All @@ -165,9 +183,13 @@ bukkit {
register(permissionRoot + "mirror")
register(permissionRoot + "chatoverride")

register(permissionRoot + "request.send")
register(permissionRoot + "request.accept")
register(permissionRoot + "request.deny")
register(permissionRoot + "request") {
childrenMap = mapOf(
(permissionRoot + "request.send") to true,
(permissionRoot + "request.accept") to true,
(permissionRoot + "request.deny") to true
)
}

register(permissionRoot + "can_fly")
register(permissionRoot + "toggle_town_fly")
Expand Down Expand Up @@ -224,6 +246,14 @@ java {

tasks.build {
dependsOn(tasks.shadowJar)

doLast {
var file = layout.buildDirectory.file("libs/FeatherMorph-${project.property("project_version")}.jar")

System.out.println("Will delete '${file.path}' to prevent anyone use the wrong jar.")

delete(file)
}
}

tasks.shadowJar {
Expand All @@ -235,6 +265,11 @@ tasks.shadowJar {
relocate("de.themoep.inventorygui", "xyz.nifeather.morph.shaded.inventorygui")
}

// https://stackoverflow.com/a/74848372
tasks.withType<Jar> {
exclude("plugin.yml")
}

tasks.withType<JavaCompile>() {
options.encoding = "UTF-8"
}

0 comments on commit 3df7e0d

Please sign in to comment.