-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
203 lines (167 loc) · 5.88 KB
/
build.gradle
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
plugins {
id 'java'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'kr.entree.spigradle' version '2.4.3'
id 'net.kyori.blossom' version "2.1.0"
id 'net.kyori.indra.git' version "3.1.3"
id "xyz.jpenilla.run-paper" version "2.2.2"
}
group 'net.fantasyrealms'
version '1.0.5'
compileJava.options.encoding = 'UTF-8'
def gitCommit = indraGit.commit().abbreviate(7).name()
static String getDate() {
def date = new Date()
def formattedDate = date.format('yyyy.MM.dd')
return formattedDate
}
compileJava {
sourceCompatibility = JavaLanguageVersion.of(17)
targetCompatibility = JavaLanguageVersion.of(17)
options.compilerArgs += ["-parameters"]
options.fork = true
}
repositories {
mavenCentral()
// 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'
}
// PlaceholderAPI
maven {
name = "PlaceholderAPI"
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://jitpack.io' }
maven { url = "https://repo.fantasyrealms.net/releases" }
maven { url = 'https://repo.jaims.dev/repository/maven-public/' }
maven { url = "https://repo.dmulloy2.net/repository/public/" }
}
ext {
//Define one of the supported mc versions
mcVersion = '1.19'
libsPackage = group + ".fantasynpc.libs."
}
dependencies {
//Adds the spigot api to your plugin
compileOnly "org.spigotmc:spigot-api:${mcVersion}-R0.1-SNAPSHOT"
// Other dependencies
compileOnly 'me.clip:placeholderapi:2.11.6'
compileOnly 'com.comphenix.protocol:ProtocolLib:4.8.0'
implementation 'org.bstats:bstats-bukkit:3.0.0'
implementation 'de.exlll:configlib-yaml:4.5.0'
implementation 'com.github.juliarn:npc-lib:2.6-RELEASE'
implementation('com.github.cryptomorin:XSeries:9.3.1') { transitive = false }
implementation 'com.github.Revxrsal.Lamp:common:3.1.5'
implementation 'com.github.Revxrsal.Lamp:bukkit:3.1.5'
implementation 'com.github.Chubbyduck1:HologramBridge:15ad8f66a6'
implementation "cc.happyareabean:MojangAPI:2.0.0"
// Adventure
implementation "net.kyori:adventure-api:4.13.1"
implementation "net.kyori:adventure-platform-bukkit:4.3.0"
implementation "net.kyori:adventure-text-minimessage:4.13.1"
// Lombok
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
testCompileOnly 'org.projectlombok:lombok:1.18.24'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'
}
publishing {
repositories {
maven {
name = "frsReleases"
url = "https://repo.fantasyrealms.net/releases/"
credentials {
username findProperty("frsRepositoryUsername").toString()
password findProperty("frsRepositoryPassword").toString()
}
}
}
publications {
maven(MavenPublication) { publication ->
project.shadow.component(publication)
publication.setGroupId(group.toString())
publication.setArtifactId(project.name.toString().toLowerCase())
}
}
}
shadowJar {
archiveClassifier.set('')
}
spigot {
// The 'name' and 'version' will be set to project.version and project.name,
// But we may set those manually.
apiVersion '1.13'
excludeLibraries = ['*']
depends 'ProtocolLib'
softDepends 'PlaceholderAPI', 'DecentHolograms', 'Holograms', 'HolographicDisplays', 'CMI'
authors 'HappyAreaBean'
}
tasks.register('cleanPlugin') {
group 'deploy'
description 'Cleans the plugin in the working directory up'
try {
delete 'working/plugins/' + shadowJar.getArchiveFileName().get() + '.jar'
} catch (ignored) {
}
}
tasks.register('deploy', Copy) {
dependsOn['cleanPlugin', 'jar']
group 'deploy'
description 'Exports you plugin to the plugin directory in your test server'
from shadowJar
into 'working/plugins'
}
tasks.register('setupServer') {
group 'server'
description 'Downloads the server jar'
def server = new File('working/server.jar')
if (server.exists()) {
return
}
}
def versionWithGit = "${project.version}-${gitCommit}"
tasks.processResources {
expand("pluginVersion": versionWithGit, "commit": gitCommit, "buildDate": getDate())
}
sourceSets {
main {
blossom {
javaSources {
property("pluginVersion", versionWithGit.toString())
property("commit", gitCommit)
property("buildDate", getDate().toString())
}
}
}
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
tasks.named('shadowJar', ShadowJar) {
enableRelocation true
relocationPrefix project.group + ".fantasynpc.libs"
}
def runDirectoryDir = project.hasProperty('runPaper.runDirectory') ? project.getProperty('runPaper.runDirectory') : "${project.rootProject.projectDir}/working"
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("1.8.8")
runDirectory.set(file(runDirectoryDir))
downloadPlugins {
url("https://hangarcdn.papermc.io/plugins/ViaVersion/ViaVersion/versions/4.8.1/PAPER/ViaVersion-4.8.1.jar")
url("https://hangarcdn.papermc.io/plugins/dmulloy2/ProtocolLib/versions/5.1.0/PAPER/ProtocolLib.jar")
}
}
}