-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle.kts
180 lines (154 loc) · 6.07 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
import java.text.SimpleDateFormat
import java.util.Date
plugins {
id("com.github.johnrengelman.shadow") version "8.1.1"
id("java")
}
val pluginVersion = "3.3.1"
allprojects {
apply(plugin = "idea")
apply(plugin = "java")
apply(plugin = "com.github.johnrengelman.shadow")
group = "org.hackedserver"
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}
tasks.processResources {
expand(mapOf("projectVersion" to pluginVersion))
}
repositories {
mavenLocal()
mavenCentral()
// server software
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
maven { url = uri("https://nexus.velocitypowered.com/repository/maven-public/") }
// BStats
maven { url = uri("https://repo.codemc.org/repository/maven-public") }
// ProtocolLib
maven { url = uri("https://repo.dmulloy2.net/repository/public/") }
// JitPack
maven { url = uri("https://jitpack.io") }
// nbt api (used by command api)
maven { url = uri("https://repo.codemc.org/repository/maven-public/") }
// adventure
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
// commandAPI snapshots
maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") }
}
}
project(":hackedserver-core") {
dependencies {
implementation("net.kyori:adventure-text-minimessage:4.14.0")
implementation("io.github.xtomlj:xtomlj:1.1.0")
}
}
project(":hackedserver-spigot") {
dependencies {
compileOnly("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT")
compileOnly("com.comphenix.protocol:ProtocolLib:5.3.0")
compileOnly("net.kyori:adventure-text-minimessage:4.14.0")
compileOnly("io.netty:netty-all:4.1.68.Final")
compileOnly(project(path = ":hackedserver-core", configuration = "shadow"))
implementation("dev.jorel:commandapi-bukkit-shade:9.6.1")
implementation("net.kyori:adventure-platform-bukkit:4.3.0")
implementation("org.bstats:bstats-bukkit:3.1.0")
}
tasks.shadowJar {
relocate("net.kyori", "org.hackedserver.shaded.kyori")
}
}
project(":hackedserver-bungeecord") {
repositories {
maven { url = uri("https://mvn.exceptionflug.de/repository/exceptionflug-public/") }
}
dependencies {
compileOnly("net.md-5:bungeecord-api:1.20-R0.2")
compileOnly("net.kyori:adventure-text-minimessage:4.14.0")
compileOnly(project(path = ":hackedserver-core", configuration = "shadow"))
implementation("net.kyori:adventure-platform-bungeecord:4.3.0")
implementation("org.bstats:bstats-bungeecord:3.1.0")
}
}
project(":hackedserver-velocity") {
repositories {
maven { url = uri("https://repo.papermc.io/repository/maven-public/") }
}
dependencies {
compileOnly("net.kyori:adventure-text-minimessage:4.13.0")
compileOnly(project(path = ":hackedserver-core", configuration = "shadow"))
compileOnly("com.velocitypowered:velocity-api:3.1.0")
annotationProcessor("com.velocitypowered:velocity-api:3.1.0")
implementation("org.bstats:bstats-velocity:3.1.0")
}
}
tasks.shadowJar {
relocate("org.bstats", "org.hackedserver.shaded.bstats")
relocate("org.tomlj", "org.hackedserver.shaded.tomlj")
relocate("org.bstats", "org.hackedserver.shaded.bstats")
manifest {
attributes(
"Built-By" to System.getProperty("user.name"),
"Version" to pluginVersion,
"Build-Timestamp" to SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss.SSSZ").format(Date()),
"Created-By" to "Gradle ${gradle.gradleVersion}",
"Build-Jdk" to "${System.getProperty("java.version")} (${System.getProperty("java.vendor")} ${System.getProperty("java.vm.version")})",
"Build-OS" to "${System.getProperty("os.name")} ${System.getProperty("os.arch")} ${System.getProperty("os.version")}"
)
}
archiveFileName.set("hackedserver-${pluginVersion}.jar")
}
dependencies {
implementation(project(path = "hackedserver-core", configuration = "shadow"))
implementation(project(path = "hackedserver-spigot", configuration = "shadow"))
implementation(project(path = "hackedserver-bungeecord", configuration = "shadow"))
implementation(project(path = "hackedserver-velocity", configuration = "shadow"))
implementation("net.kyori:adventure-text-minimessage:4.13.0")
implementation("org.yaml:snakeyaml:1.30")
}
tasks.compileJava {
dependsOn(tasks.clean)
}
tasks.build {
dependsOn(tasks.shadowJar)
}
val copyJar: Boolean = project.findProperty("copyJar")?.toString()?.toBoolean() ?: false
val pluginPath: String? = project.findProperty("hacked_server_plugin_path")?.toString()
val velocityPluginPath: String? = project.findProperty("velocity_plugin_path")?.toString()
val bungeePluginPath: String? = project.findProperty("bungee_plugin_path")?.toString()
if (copyJar) {
val copyJarTask = tasks.register<Copy>("copyJarTask") {
if (pluginPath != null) {
from("build/libs/hackedserver-all.jar")
into(pluginPath)
doLast {
println("Copied to plugin directory $pluginPath")
}
}
if (velocityPluginPath != null) {
from("build/libs/hackedserver-all.jar")
into(velocityPluginPath)
doLast {
println("Copied to plugin directory $velocityPluginPath")
}
}
if (bungeePluginPath != null) {
from("build/libs/hackedserver-all.jar")
into(bungeePluginPath)
doLast {
println("Copied to plugin directory $bungeePluginPath")
}
}
}
copyJarTask {
dependsOn(tasks.shadowJar)
}
tasks.named("build") {
dependsOn(copyJarTask)
}
}