1
- import io.papermc.paperweight.util.path
2
- import java.util.*
1
+ import java.net.URI
3
2
4
3
plugins {
5
4
`java- library`
@@ -11,22 +10,12 @@ plugins {
11
10
// = = =
12
11
13
12
val pluginName = " NyaaCore"
14
- val majorVersion = 9
15
- val minorVersion = 4
16
-
17
- val paperApiName = " 1.21-R0.1-SNAPSHOT"
13
+ val paperApiName = " 1.21.1-R0.1-SNAPSHOT"
18
14
19
15
// = = =
20
16
21
- // for Jenkins CI
22
- val buildNumber = System .getenv(" BUILD_NUMBER" ) ? : " x"
23
- val mavenDirectory = System .getenv(" MAVEN_DIR" ) ? : layout.buildDirectory.dir(" repo" ).path.toString()
24
- val javaDocDirectory = System .getenv(" JAVADOC_DIR" ) ? : layout.buildDirectory.dir(" javadoc" ).path.toString()
25
-
26
- // Version used for distribution. Different from maven repo
27
17
group = " cat.nyaa"
28
- // archivesBaseName = "${pluginNameUpper}-mc$minecraftVersion"
29
- version = " $majorVersion .$minorVersion "
18
+ version = " 9.4"
30
19
31
20
java {
32
21
// Configure the java toolchain. This allows gradle to auto-provision JDK 21 on systems that only have JDK 8 installed for example.
@@ -35,19 +24,14 @@ java {
35
24
36
25
repositories {
37
26
mavenCentral()
38
- maven {
39
- url = uri(" https://papermc.io/repo/repository/maven-public/" )
40
- } // paper
41
- maven { url = uri(" https://libraries.minecraft.net" ) } // mojang
42
- maven { url = uri(" https://repo.essentialsx.net/releases/" ) } // essentials
27
+ maven (" https://papermc.io/repo/repository/maven-public/" ) // paper
28
+ maven (" https://libraries.minecraft.net" ) // mojang
29
+ maven (" https://repo.essentialsx.net/releases/" ) // essentials
43
30
// maven { url = uri("https://ci.nyaacat.com/maven/") } // nyaacat
44
-
45
31
}
46
32
47
33
dependencies {
48
34
paperweight.paperDevBundle(paperApiName)
49
- // paperweight.foliaDevBundle("1.21-R0.1-SNAPSHOT")
50
- // paperweight.devBundle("com.example.paperfork", "1.21-R0.1-SNAPSHOT")
51
35
compileOnly(" net.essentialsx:EssentialsX:2.20.1" ) // soft dep
52
36
compileOnly(" org.jetbrains:annotations:24.1.0" )
53
37
// Testing
@@ -66,20 +50,16 @@ publishing {
66
50
from(components[" java" ])
67
51
groupId = group.toString()
68
52
artifactId = pluginName.lowercase()
69
- version = " $majorVersion . $minorVersion . $buildNumber -mc ${getMcVersion(paperApiName)} "
53
+ version = project.version.toString()
70
54
}
71
55
}
72
56
repositories {
73
57
maven {
74
- name = " PublishMaven"
75
- url = uri(mavenDirectory)
76
- val mavenUserName = System .getenv(" MAVEN_USERNAME" )
77
- val mavenPassword = System .getenv(" MAVEN_PASSWORD" )
78
- if (mavenUserName != null && mavenPassword != null ) {
79
- credentials {
80
- username = mavenUserName
81
- password = mavenPassword
82
- }
58
+ name = " github-package"
59
+ url = URI (System .getenv(" GITHUB_MAVEN_URL" ) ? : " https://github.com" )
60
+ credentials {
61
+ username = System .getenv(" GITHUB_ACTOR" )
62
+ password = System .getenv(" GITHUB_TOKEN" )
83
63
}
84
64
}
85
65
}
@@ -95,23 +75,26 @@ reobfJar {
95
75
96
76
97
77
tasks {
98
-
78
+ // ref: https://docs.papermc.io/paper/dev/userdev
99
79
// 1)
100
80
// For >=1.20.5 when you don't care about supporting spigot
101
- // paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION
81
+ // set:
82
+ paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration .MOJANG_PRODUCTION
83
+ // and it will eliminate the -dev suffix from the artifact name which indicates the artifact is
84
+ // mojang-mapped and won't work on the most of the server but at 1.20.5 the paper
85
+ // uses mojang-mapping by default, so it doesn't matter anymore.
86
+ //
102
87
103
88
// 2)
104
89
// For 1.20.4 or below, or when you care about supporting Spigot on >=1.20.5
105
90
// Configure reobfJar to run when invoking the build task
106
91
/*
107
- // Configure reobfJar to run when invoking the build task
108
92
assemble {
109
93
dependsOn(reobfJar)
110
94
}
111
95
*/
112
96
113
97
withType<ProcessResources > {
114
-
115
98
val newProperties = project.properties.toMutableMap()
116
99
newProperties[" api_version" ] = getMcVersion(paperApiName)
117
100
filesMatching(" plugin.yml" ) {
@@ -121,7 +104,6 @@ tasks {
121
104
122
105
compileJava {
123
106
options.encoding = Charsets .UTF_8 .name() // We want UTF-8 for everything
124
-
125
107
// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
126
108
// See https://openjdk.java.net/jeps/247 for more information.
127
109
options.release.set(21 )
@@ -158,5 +140,7 @@ tasks {
158
140
}
159
141
160
142
private fun getMcVersion (apiNameString : String ): String {
161
- return apiNameString.split(' -' )[0 ]
143
+ val version = apiNameString.split(' -' )[0 ]
144
+ val versionInArray = version.split(' .' )
145
+ return " ${versionInArray[0 ]} .${versionInArray[1 ]} "
162
146
}
0 commit comments