forked from colesium-org/PTJDNC
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
133 lines (114 loc) · 4.56 KB
/
build.gradle
File metadata and controls
133 lines (114 loc) · 4.56 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
plugins {
id 'java-library'
id 'io.github.goooler.shadow' version '8.1.8'
id 'xyz.jpenilla.run-paper' version '3.0.1'
}
group = 'org.crayne'
version = pluginVersion
description = 'Name coloring plugin, inspired by 0b0ts playtime name color feature, rewards users with extra name colors depending on their joining date and playtime.'
ext {
minecraftVersion = project.findProperty('minecraftVersion') ?: '1.20.4'
javaVersion = JavaVersion.toVersion(project.findProperty('javaVersion') ?: '21')
pluginVersion = project.findProperty('pluginVersion') ?: '1.0.0'
donationApiVersion = project.findProperty('donationApiVersion') ?: '1.0.2'
}
repositories {
mavenCentral()
maven {
url = 'https://repo.papermc.io/repository/maven-public/'
}
maven {
url = 'https://oss.sonatype.org/content/groups/public/'
}
maven {
url = 'https://repo.codemc.org/repository/maven-public/'
}
maven {
// FoliaLib
url = 'https://nexuslite.gcnt.net/repos/other/'
content {
includeGroup 'com.tcoded'
}
}
}
configurations.configureEach {
resolutionStrategy {
// force a safe version of Commons Lang
// pick a version you know is patched, e.g. 3.18.0
force 'org.apache.commons:commons-lang3:3.18.0'
}
}
dependencies {
// Paper API
// https://jd.papermc.io/paper/1.20/
compileOnly group: 'io.papermc.paper', name: 'paper-api', version: "${minecraftVersion}-R0.1-SNAPSHOT"
// Folia API
// https://jd.papermc.io/folia/1.20/
//compileOnly group: 'dev.folia', name: 'folia-api', version: "${project.minecraft_version}-R0.1-SNAPSHOT"
// https://www.jetbrains.com/help/idea/annotating-source-code.html
compileOnly group: 'org.jetbrains', name: 'annotations', version: "26.0.1"
// https://github.com/jcabi/jcabi-aspects
shadow group: 'com.jcabi', name: 'jcabi-aspects', version: '0.25.1'
// https://github.com/TechnicallyCoded/FoliaLib
shadow group: 'com.tcoded', name: 'FoliaLib', version: "0.4.2"
// DonationAPI (from GitHub releases, downloaded at build time)
compileOnly files("$rootDir/lib/DonationAPI-${donationApiVersion}.jar")
}
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.release = sourceCompatibility.toInteger()
}
processResources {
filteringCharset "UTF-8"
filesMatching("plugin.yml") {
filter { line -> line.replace("@VERSION@", project.version) }
filter { line -> line.replace("@DESCRIPTION@", project.description) }
}
}
// https://imperceptiblethoughts.com/shadow/
shadowJar {
configurations = [project.configurations.shadow]
archiveFileName = "${project.name}-${project.version}+${minecraftVersion}.jar"
destinationDirectory = layout.buildDirectory.dir('dist')
// Relocations (shading) setup
relocate('org.jetbrains', 'org.crayne.jetbrains')
relocate('com.jcabi', 'org.crayne.jcabi')
relocate('com.tcoded.folialib', 'org.crayne.tcoded.folialib')
// delete unshaded jar
doLast {
file(jar.archiveFile).delete()
}
}
tasks.named('build') { finalizedBy(shadowJar) }
tasks {
runServer {
runDirectory = project.layout.projectDirectory.dir('run')
minecraftVersion(minecraftVersion)
dependsOn('build')
systemProperty('com.mojang.eula.agree', 'true')
downloadPlugins {
url("https://github.com/ViaVersion/ViaBackwards/releases/download/5.5.0/ViaBackwards-5.5.0.jar")
url("https://github.com/ViaVersion/ViaVersion/releases/download/5.5.0/ViaVersion-5.5.0.jar")
url("https://github.com/dmulloy2/ProtocolLib/releases/download/5.4.0/ProtocolLib.jar")
url("https://ci.codemc.io/job/Updated-NoCheatPlus/job/Updated-NoCheatPlus/198/artifact/target/NoCheatPlus.jar")
}
}
}
tasks.register('downloadDonationApi') {
doLast {
def libDir = file("$rootDir/lib")
if (!libDir.exists()) libDir.mkdirs()
def jar = file("$rootDir/lib/DonationAPI-${donationApiVersion}.jar")
if (!jar.exists()) {
println "Downloading DonationAPI-${donationApiVersion}.jar..."
def url = "https://github.com/zeroBzeroT/DonationAPI/releases/download/${donationApiVersion}/DonationAPI-${donationApiVersion}.jar"
ant.get(src: url, dest: jar, verbose: true)
}
}
}
//tasks.named('compileJava').configure { dependsOn(downloadDonationApi) }
//tasks.named('compileTestJava').configure { dependsOn(downloadDonationApi) }