This repository has been archived by the owner on Dec 7, 2024. It is now read-only.
generated from esoterictemplates/paper-template-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
112 lines (82 loc) · 2.79 KB
/
build.gradle.kts
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import org.gradle.api.JavaVersion
import xyz.jpenilla.resourcefactory.bukkit.BukkitPluginYaml
plugins {
java
`java-library`
`maven-publish`
id("io.papermc.paperweight.userdev") version "1.7.2"
id("xyz.jpenilla.resource-factory-bukkit-convention") version "1.1.1"
id("xyz.jpenilla.run-paper") version "2.3.0"
}
val groupStringSeparator = "."
val kebabcaseStringSeparator = "-"
val snakecaseStringSeparator = "_"
fun kebabcase(normalString: String): String {
return normalString.lowercase().replace(" ", kebabcaseStringSeparator)
}
fun capitalizeFirstLetter(string: String): String {
return string.first().uppercase() + string.slice(IntRange(1, string.length - 1))
}
fun snakecase(kebabcaseString: String): String {
return kebabcaseString.lowercase().replace(kebabcaseStringSeparator, snakecaseStringSeparator)
}
fun pascalcase(kebabcaseString: String): String {
var pascalCaseString = ""
val splitString = kebabcaseString.split(kebabcaseStringSeparator)
for (part in splitString) {
pascalCaseString += capitalizeFirstLetter(part)
}
return pascalCaseString
}
description = "A plugin to display a title and a changing subtitle."
val mainProjectAuthor = "Esoteric Enderman"
val projectAuthors = listOfNotNull(mainProjectAuthor)
val topLevelDomain = "dev"
val projectNameString = rootProject.name
group = topLevelDomain + groupStringSeparator + "enderman"
version = "0.0.13"
val buildDirectoryString = buildDir.toString()
val projectGroupString = group.toString()
val projectVersionString = version.toString()
val javaVersion = 17
val javaVersionEnumMember = JavaVersion.valueOf("VERSION_$javaVersion")
val paperApiMinecraftVersion = "1.20"
val paperApiVersion = "$paperApiMinecraftVersion-R0.1-SNAPSHOT"
java {
sourceCompatibility = javaVersionEnumMember
targetCompatibility = javaVersionEnumMember
toolchain.languageVersion = JavaLanguageVersion.of(javaVersion)
}
dependencies {
paperweight.paperDevBundle(paperApiVersion)
}
tasks {
compileJava {
options.release = javaVersion
}
javadoc {
options.encoding = Charsets.UTF_8.name()
}
}
bukkitPluginYaml {
name = "Welcome"
description = project.description
authors = projectAuthors
version = project.version.toString()
apiVersion = paperApiMinecraftVersion
main = projectGroupString + groupStringSeparator + "commissions.minecraft.plugins.welcome" + groupStringSeparator + pascalcase(projectNameString)
load = BukkitPluginYaml.PluginLoadOrder.STARTUP
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
groupId = projectGroupString
artifactId = projectNameString
version = projectVersionString
}
}
}
tasks.named("publishMavenJavaPublicationToMavenLocal") {
dependsOn(tasks.named("build"))
}