-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
63 lines (51 loc) · 1.77 KB
/
build.gradle.kts
File metadata and controls
63 lines (51 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription.Permission.Default.OP
plugins {
java
id("net.minecrell.plugin-yml.bukkit") version "0.5.2"
}
group = ofProp("package_group", "")
version = ofProp("plugin_version", "")
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_17
}
repositories {
mavenCentral()
}
repositories {
mavenCentral()
maven {
name = "paper"
url = uri("https://repo.papermc.io/repository/maven-public/")
}
}
val spigotVersion = ofProp("spigot")
dependencies {
compileOnly(group = "io.papermc.paper", name = "paper-api", version = spigotVersion)
testImplementation("junit", "junit", "4.12")
}
bukkit {
author = "WhiteCat"
description = ofProp("plugin_description", "")
main = ofProp("plugin_main_class", "")
.replace("\${group}", "$group", true)
.replace("\${name}", ofProp("plugin_name", ""), true)
apiVersion = "1.13"
permissions {
register("superspawnpoint.command.superspawnpoint") {
default = OP
}
}
commands {
register("superspawnpoint") {
permission = "superspawnpoint.command.superspawnpoint"
usage = "/<command> <player_name> <world> <x> <y> <z> [yaw] [pitch]"
}
}
}
infix fun <A> A.toProp(name: String) = this to extra[name]
fun String.suffixIfNot(suffix: String) = if (this.endsWith(suffix)) this else "$this$suffix"
fun ofProp(propName: String, suffix: String = "_version", default: String = ""): String =
extra[propName.suffixIfNot(suffix)] as? String ?: default
fun String.propVer(propName: String = split(":").last()) =
"$this:${ofProp(propName)}"
fun ExternalModuleDependency.propVersion(propName: String) = version { prefer(ofProp(propName)) }