generated from Sunderia/SpigotTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
124 lines (110 loc) · 3.38 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
plugins {
id 'java'
id 'maven-publish'
id 'kr.entree.spigradle' version '2.3.4'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
apply from: rootProject.file('specialSource.gradle')
apply from: rootProject.file('buildtools.gradle')
group 'fr.sunderia'
version '1.0-SNAPSHOT'
String mcVersion = '1.18.1'
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
compileJava {
options.encoding = "UTF-8"
}
repositories {
mavenCentral()
mavenLocal()
protocolLib()
maven {
name 'SunderiaRepo'
url 'https://maven.galaxyfight.fr/snapshots'
}
maven {
name = "Jeff"
url = 'https://hub.jeff-media.com/nexus/repository/jeff-media-public/'
}
}
dependencies {
compileOnly spigot(mcVersion)
compileOnly "org.spigotmc:spigot:$mcVersion-R0.1-SNAPSHOT:remapped-mojang"
compileOnly protocolLib("4.8.0")
shadow 'fr.sunderia:SunderiaUtils:1.5.3-SNAPSHOT'
shadow 'com.jeff_media:CustomBlockData:1.0.5'
}
setMCVersion {
version = mcVersion
}
shadowJar {
configurations = [project.configurations.runtimeClasspath, project.configurations.shadow]
relocate 'com.jeff_media.customblockdata.CustomBlockData', 'fr.sunderia.customblockdata.CustomBlockData'
}
afterEvaluate {
shadowJar {
doLast {
def outputFiles = outputs.files.files
for (inputFile in outputFiles) {
File intermediateFile = new File(temporaryDir, inputFile.name.replace('.jar', '-obf.jar'))
File outputFile = inputFile
remapMojangToSpigot(inputFile, intermediateFile, outputFile, "$mcVersion-R0.1-SNAPSHOT")
}
}
}
}
tasks.prepareSpigotPlugins.dependsOn shadowJar
tasks.runSpigot.dependsOn prepareSpigotPlugins
spigot {
debug {
args '--nojline', '--max-players', '100'
jvmArgs '-Xmx2G'
serverPort 25565
eula = true
}
authors group.toString().split('\\.')[1]
apiVersion mcVersion.split("\\.")[0..1].join('.')
depends('ProtocolLib')
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = project.name
from components.java
pom {
name = project.name
description = project.description
url = "https://github.com/${group.toString().split('\\.')[1]}/${wordUppercase(project.name)}"
licenses {
license {
name = 'MIT'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'minemobs'
name = 'minemobs'
}
}
}
}
}
repositories {
maven {
name 'sunderiaRepo'
def extension = version.toString().endsWith('-SNAPSHOT') ? 'snapshots' : 'releases'
url 'https://maven.galaxyfight.fr/' + extension
credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
}
}
}
private static wordUppercase(String s) {
StringBuilder sb = new StringBuilder(s.length())
for (final def str in s.split("\\s+")) {
sb.append(str.substring(0, 1).toUpperCase()).append(str.substring(1))
}
return sb.toString()
}