-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
164 lines (125 loc) · 4.5 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
164 lines (125 loc) · 4.5 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
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
import com.jcraft.jsch.ChannelSftp
import com.jcraft.jsch.JSch
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
plugins {
id("java")
id("io.github.goooler.shadow") version "8.1.8"
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
id("xyz.jpenilla.run-paper") version "2.3.1"
}
group = "de.unknowncity"
version = "0.1.0"
val mainClass = "${group}.${rootProject.name.lowercase()}.PlotsPlugin"
val shadeBasePath = "${group}.${rootProject.name.lowercase()}.libs."
repositories {
maven("https://repo.papermc.io/repository/maven-public/")
mavenCentral()
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://repo.xenondevs.xyz/releases")
maven("https://maven.enginehub.org/repo/")
maven("https://repo.unknowncity.de/snapshots")
maven("https://repo.nightexpressdev.com/releases")
maven("https://jitpack.io")
mavenLocal()
}
dependencies {
bukkitLibrary(libs.jackson.yaml)
bukkitLibrary(libs.configurate.yaml)
implementation(libs.invui)
compileOnly(libs.coinsengine) {
exclude(group = "*", module = "*")
}
compileOnly(libs.paper.api)
compileOnly(libs.papi)
compileOnly(libs.astralib)
compileOnly(libs.worldguard)
compileOnly(libs.plan)
implementation(platform("com.intellectualsites.bom:bom-newest:1.55")) // Ref: https://github.com/IntellectualSites/bom
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Core")
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit")
testImplementation(platform("org.junit:junit-bom:6.0.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("com.github.mwiede:jsch:2.27.7")
}
}
bukkit {
name = "UC-Plots"
version = "${project.version}"
description = "A simple but effective single mariadb plugin for paper"
author = "UnknownCity"
main = mainClass
foliaSupported = false
apiVersion = "1.21"
load = BukkitPluginDescription.PluginLoadOrder.POSTWORLD
depend = listOf("AstraLib", "WorldGuard", "CoinsEngine")
softDepend = listOf("PlaceholderAPI")
defaultPermission = BukkitPluginDescription.Permission.Default.OP
}
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
}
tasks {
shadowJar {
fun relocateDependency(from: String) = relocate(from, "$shadeBasePath$from")
relocateDependency("xyz.xenondevs.invui")
}
compileJava {
options.encoding = "UTF-8"
}
jar {
archiveBaseName.set(rootProject.name)
archiveVersion.set(rootProject.version.toString())
}
runServer {
minecraftVersion("1.21.10")
downloadPlugins {
modrinth("WorldGuard", "7.0.14")
modrinth("CoinsEngine", "2.5.2")
modrinth("NightCore", "2.8.3")
url("https://download.luckperms.net/1605/bukkit/loader/LuckPerms-Bukkit-5.5.16.jar")
url("https://ci.athion.net/job/FastAsyncWorldEdit/1202/artifact/artifacts/FastAsyncWorldEdit-Paper-2.14.1-SNAPSHOT-1202.jar")
url("https://ci.unknowncity.de/job/AstraLib/56/artifact/astralib-paper-plugin/build/libs/AstraLib-Paper-0.7.0-SNAPSHOT-%2356.jar")
}
}
register<Copy>("copyToServer") {
val path = System.getenv("SERVER_DIR")
if (path.toString().isEmpty()) {
println("No SERVER_DIR env variable set")
return@register
}
from(shadowJar)
destinationDir = File(path.toString())
}
register("uploadJarToFTP") {
dependsOn(shadowJar)
doLast {
val jarFile = getByName("shadowJar").outputs.files.singleFile
val host = System.getenv("FTP_SERVER")!!
val port = System.getenv("FTP_PORT")?.toInt() ?: 22
val user = System.getenv("FTP_USER")!!
val password = System.getenv("FTP_PASSWORD")!!
val jsch = JSch()
val session = jsch.getSession(user, host, port).apply {
setPassword(password)
setConfig("StrictHostKeyChecking", "no")
connect()
}
val channel = session.openChannel("sftp") as ChannelSftp
channel.connect()
channel.cd("/plugins")
channel.put(jarFile.absolutePath, jarFile.name)
println("Upload successful!")
channel.disconnect()
session.disconnect()
}
}
compileJava {
dependsOn(clean)
}
}