-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
174 lines (137 loc) · 5.28 KB
/
build.gradle
File metadata and controls
174 lines (137 loc) · 5.28 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
165
166
167
168
169
170
171
172
173
174
import java.nio.file.Files
plugins {
id 'java'
id "xyz.jpenilla.run-paper" version "3.0.1"
id 'net.kyori.indra.git' version "3.1.3"
id 'com.gradleup.shadow' version '8.3.5'
id "io.freefair.lombok" version "8.11"
}
group = 'cc.happyareabean'
version = '1.1.11'
def gitCommit = indraGit.commit().abbreviate(7).name()
def fullVersion = "${project.version}-${gitCommit}"
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
compileJava {
options.compilerArgs += ["-parameters"]
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
//Added spigot repository
maven {
name = 'Spigot'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
//Added md5's repository to add the missing BungeeCord-Chat api
maven {
name = 'BungeeCord-Chat'
url = 'https://oss.sonatype.org/content/repositories/snapshots'
}
maven {
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
maven {
name = "sonatype-oss-snapshots1"
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url = "https://repo.fantasyrealms.net/releases"
}
maven {
url = "https://repo.fantasyrealms.net/other-snapshots"
}
maven {
name = "fantasyrealmsDowngraded"
url = uri("https://repo.fantasyrealms.net/downgraded")
}
maven { url = 'https://jitpack.io' }
//Add your repositories here
mavenLocal()
}
ext {
//Define one of the supported mc versions
mcVersion = '1.20.1'
}
dependencies {
//Adds the spigot api to your plugin
compileOnly "io.papermc.paper.downgraded:paper-api:1.21.6-R0.1-SNAPSHOT"
compileOnly 'me.clip:placeholderapi:2.11.6'
implementation "net.kyori:adventure-api:4.25.0"
implementation "net.kyori:adventure-text-minimessage:4.25.0"
implementation "net.kyori:adventure-platform-bukkit:4.4.1"
implementation 'com.github.HappyAreaBean.Spiget-Update:bukkit:1.4.7-SNAPSHOT'
implementation "com.squareup.okhttp3:okhttp:4.12.0"
implementation 'io.github.revxrsal:lamp.common:4.0.0-rc.13'
implementation 'io.github.revxrsal:lamp.bukkit:4.0.0-rc.13'
implementation 'io.github.revxrsal:lamp.brigadier:4.0.0-rc.13'
implementation("com.github.HappyAreaBean.ConfigLib:configlib-bukkit:v2.3.1")
implementation 'org.bstats:bstats-bukkit:3.0.2'
}
processResources {
if (project.version.toString().endsWith("-SNAPSHOT"))
version = fullVersion
project.properties.put("pluginVersion", project.version)
expand project.properties
}
def SERV_DIR = System.getenv('SERV_DIR') != null ? System.getenv('SERV_DIR') : "${project.rootProject.projectDir}/working"
def SERV_JAR = System.getenv('SERV_JAR') != null ? System.getenv('SERV_JAR') : null
def SERV_VER = System.getenv('SERV_VER') != null ? System.getenv('SERV_VER') : mcVersion
def libsPackage = group + ".sjm.libs"
tasks {
runServer {
// Configure the Minecraft version for our task.
// This is the only required configuration besides applying the plugin.
// Your plugin's jar (or shadowJar if present) will be used automatically.
minecraftVersion(SERV_VER)
if (SERV_JAR != null)
serverJar(runDirectory.file(SERV_JAR as String))
runDirectory.set(file(SERV_DIR))
}
shadowJar {
archiveClassifier.set('')
relocate("revxrsal.commands", "${libsPackage}.lamp")
relocate("org.bstats", "${libsPackage}.bstats")
relocate("org.inventivetalent.update.spiget", "${libsPackage}.spigetupdater")
relocate("de.exlll.configlib", "${libsPackage}.configlib")
relocate("org.yaml.snakeyaml", "${libsPackage}.snakeyaml")
relocate("net.kyori", "${libsPackage}.kyori")
relocate("okio", "${libsPackage}.okio")
relocate("okhttp3", "${libsPackage}.okhttp3")
relocate("org.intellij", "${libsPackage}.intellij")
relocate("org.jetbrains.annotations", "${libsPackage}.annotations")
relocate("kotlin", "${libsPackage}.kotlin")
}
}
int SERV_JAVA = System.getenv("SERV_JAVA") == null ? 21 : System.getenv("SERV_JAVA") as int
tasks.withType(xyz.jpenilla.runtask.task.AbstractRun) {
javaLauncher = javaToolchains.launcherFor {
vendor = JvmVendorSpec.JETBRAINS
languageVersion = JavaLanguageVersion.of(SERV_JAVA)
}
jvmArgs "-XX:+AllowEnhancedClassRedefinition"
}
abstract class PrintSnapshotVersionTask extends DefaultTask {
@Input String projectVersion
@Input String buildDirectory
// Constructor to set the project version
PrintSnapshotVersionTask() {
this.projectVersion = project.version.toString()
this.buildDirectory = project.layout.buildDirectory.get().asFile.toString()
}
@TaskAction
def print() {
File versionsDir = new File(buildDirectory, "versions")
File textFile = new File(versionsDir, "snapshot.txt")
versionsDir.mkdirs()
Files.deleteIfExists(textFile.toPath())
textFile.createNewFile()
textFile.text = projectVersion // Use the stored project version
}
}
tasks.register('snapshotVersion', PrintSnapshotVersionTask)