Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.

Commit 27c5f62

Browse files
committed
Change JenkinsNumber to mohist_api
1 parent 2ba2589 commit 27c5f62

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

build.gradle

+8-11
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ project(':mohist') {
149149
BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.1.1:fatjar'
150150
}
151151

152-
version = '1.12.2-' + JenkinsNumber()
152+
version = '1.12.2-' + mohist_api()
153153

154154
patcher {
155155
exc = file("$rootDir/src/main/resources/forge.exc")
@@ -815,21 +815,18 @@ task setup() {
815815
dependsOn ':mohist:extractMapped' //These must be strings so that we can do lazy resolution. Else we need evaluationDependsOnChildren above
816816
}
817817

818-
static def JenkinsNumber() {
819-
return 344
820-
/*
818+
static def mohist_api() {
821819
try {
822-
def conn = new URL("https://ci.codemc.io/job/MohistMC/job/Mohist-1.12.2/api/json").openConnection()
820+
URL url = new URL("https://mohistmc.com/api/v2/projects/mohist/1.12.2/builds/latest")
821+
HttpURLConnection conn = (HttpURLConnection) url.openConnection()
823822
conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0")
824823
conn.connect()
825824
def root = conn.content.text
826-
def jsonSluper = new JsonSlurper()
825+
def jsonSlurper = new JsonSlurper()
826+
def data = jsonSlurper.parseText(root)
827827

828-
String data = jsonSluper.parseText(root)
829-
def number = data.substring(data.indexOf("number")).split(",")
830-
return Integer.valueOf(number[0].replace("number=", "")).intValue()
831-
} catch (Exception e1) {
828+
return Integer.valueOf(data.build.number) + 1
829+
} catch (Exception ignored) {
832830
return 'dev'
833831
}
834-
*/
835832
}

0 commit comments

Comments
 (0)