2
2
3
3
import xyz.jpenilla.runtask.task.AbstractRun
4
4
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
5
- import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
6
5
import xyz.jpenilla.runpaper.task.RunServer
7
6
import io.papermc.hangarpublishplugin.model.Platforms
8
7
import org.gradle.internal.extensions.stdlib.toDefaultLowerCase
@@ -11,7 +10,6 @@ import java.io.ByteArrayOutputStream
11
10
plugins {
12
11
id(" java" )
13
12
id(" maven-publish" )
14
- alias(libs.plugins.plugin.yml)
15
13
alias(libs.plugins.minotaur)
16
14
alias(libs.plugins.run.server)
17
15
alias(libs.plugins.shadow)
@@ -25,6 +23,7 @@ val version = properties["version"] as String +
25
23
if (versionIsBeta)
26
24
" -${getGitCommitHash()} "
27
25
else " "
26
+ val targetJavaVersion = (properties[" java-version" ] as String ).toInt()
28
27
29
28
if (project.hasProperty(" NEXUS_USERNAME" ) && project.hasProperty(" NEXUS_PASSWORD" )) {
30
29
java {
@@ -87,88 +86,60 @@ if (project.hasProperty("NEXUS_USERNAME") && project.hasProperty("NEXUS_PASSWORD
87
86
}
88
87
89
88
allprojects {
89
+ apply (plugin = " java" )
90
+
90
91
repositories {
91
92
mavenCentral()
92
93
maven {
93
94
name = " papermc-repo"
94
95
url = uri(" https://repo.papermc.io/repository/maven-public/" )
95
96
}
97
+ maven {
98
+ name = " AlessioDP"
99
+ url = uri(" https://repo.alessiodp.com/releases" )
100
+ }
96
101
}
97
- }
98
102
99
- repositories {
100
- maven {
101
- name = " sonatype"
102
- url = uri(" https://oss.sonatype.org/content/groups/public/" )
103
+ dependencies {
104
+ // JetBrains Annotations
105
+ compileOnly(rootProject.libs.jetbrains.annotations)
106
+
107
+ // Lombok
108
+ compileOnly(rootProject.libs.lombok)
109
+ annotationProcessor(rootProject.libs.lombok)
103
110
}
104
- maven {
105
- name = " AlessioDP"
106
- url = uri(" https://repo.alessiodp.com/releases" )
111
+
112
+ tasks.withType<JavaCompile >().configureEach {
113
+ if (targetJavaVersion >= 10 || JavaVersion .current().isJava10Compatible) {
114
+ options.release = targetJavaVersion
115
+ options.encoding = " UTF-8"
116
+ }
117
+ }
118
+
119
+ java {
120
+ val javaVersion = JavaVersion .toVersion(targetJavaVersion)
121
+ sourceCompatibility = javaVersion
122
+ targetCompatibility = javaVersion
123
+ if (JavaVersion .current() < javaVersion) {
124
+ toolchain.languageVersion = JavaLanguageVersion .of(targetJavaVersion)
125
+ }
107
126
}
108
127
}
109
128
110
129
dependencies {
111
- // JetBrains Annotations
112
- compileOnly(libs.jetbrains.annotations)
113
-
114
- // Paper API
115
130
compileOnly(libs.paper.api)
116
131
117
- // Lombok
118
- compileOnly(libs.lombok)
119
- annotationProcessor(libs.lombok)
132
+ implementation(libs.bundles.shade)
120
133
121
- // Ansi
122
- compileOnly(libs.jansi)
123
- bukkitLibrary(libs.jansi)
124
-
125
- // Libby
126
- implementation(libs.libby)
127
-
128
- // Folia module
129
134
implementation(project(" :folia" ))
130
- }
131
-
132
- val targetJavaVersion = 17
133
-
134
- tasks.withType<JavaCompile >().configureEach {
135
- if (targetJavaVersion >= 10 || JavaVersion .current().isJava10Compatible) {
136
- options.release = targetJavaVersion
137
- options.encoding = " UTF-8"
138
- }
139
- }
140
135
141
- java {
142
- val javaVersion = JavaVersion .toVersion(targetJavaVersion)
143
- sourceCompatibility = javaVersion
144
- targetCompatibility = javaVersion
145
- if (JavaVersion .current() < javaVersion) {
146
- toolchain.languageVersion = JavaLanguageVersion .of(targetJavaVersion)
147
- }
136
+ implementation(project(" :plugin" ))
148
137
}
149
138
150
139
tasks.named<Jar >(" jar" ) {
151
140
enabled = false
152
141
}
153
142
154
- bukkit {
155
- name = " AdriAPI"
156
- main = " me.adrigamer2950.adriapi.AdriAPI"
157
- apiVersion = " 1.17"
158
- author = properties[" author" ] as String?
159
- description = properties[" description" ] as String?
160
- website = " https://github.com/Adrigamer2950/AdriAPI"
161
- load = BukkitPluginDescription .PluginLoadOrder .STARTUP
162
- foliaSupported = true
163
-
164
- commands {
165
- register(" adriapi" ) {
166
- description = " Main command"
167
- usage = " /adriapi"
168
- }
169
- }
170
- }
171
-
172
143
fun getJarFile (): File ? {
173
144
val jarFile = File (" ./gh-assets" ).listFiles()?.firstOrNull { it.name.endsWith(" .jar" ) }
174
145
return jarFile
0 commit comments