-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
85 lines (73 loc) · 2.48 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
import io.papermc.paperweight.userdev.ReobfArtifactConfiguration
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.nio.file.Files
plugins {
java
`maven-publish`
id("com.gradleup.shadow") version "8.3.5"
id("xyz.jpenilla.run-paper") version "2.3.1"
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
id("io.papermc.paperweight.userdev") version "1.7.7"
}
repositories {
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://eldonexus.de/repository/maven-releases/")
}
group = "club.devcord.gamejam"
version = "1.0.0"
description = "gamejam"
dependencies {
testImplementation("junit:junit:4.13.2")
paperweight.paperDevBundle("1.21.1-R0.1-SNAPSHOT")
compileOnly("de.chojo.pluginjam:plugin-paper:1.0.4")
}
paperweight {
reobfArtifactConfiguration = ReobfArtifactConfiguration.MOJANG_PRODUCTION
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
publishing {
publications.create<MavenPublication>("maven") {
from(components["java"])
}
}
tasks {
compileJava {
options.encoding = "UTF-8"
}
runServer {
minecraftVersion("1.21.1")
}
register("uploadJar") {
dependsOn(jar)
doLast {
val filePath = project.tasks.jar.get().archiveFile.get().asFile.toPath()
// Add the upload api url to your repo secrets under UPLOAD_URL
// Obtain the upload url via /team api
val apiUrl = System.getenv("UPLOAD_URL") ?: throw RuntimeException("Please set UPLOAD_URL in your github secrets")
val client = HttpClient.newHttpClient()
val request = HttpRequest.newBuilder()
.uri(URI.create(apiUrl))
//.uri(URI.create("$apiUrl?restart=true"))
.header("Content-Type", "application/octet-stream")
.POST(HttpRequest.BodyPublishers.ofByteArray(Files.readAllBytes(filePath)))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
if (response.statusCode() != 202) throw RuntimeException("Could not upload:\n" + response.body())
println("Upload successful")
}
}
}
bukkit {
name = "GameJamPlugin"
load = net.minecrell.pluginyml.bukkit.BukkitPluginDescription.PluginLoadOrder.STARTUP
main = "club.devcord.gamejam.JamPlugin"
apiVersion = "1.21"
}