Skip to content

Commit d6c4938

Browse files
fix: shadow dependency and versioning match
1 parent 2e4fb16 commit d6c4938

File tree

2 files changed

+40
-13
lines changed

2 files changed

+40
-13
lines changed

build.gradle

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,34 @@ plugins {
66
}
77

88
group 'cam72cam.universalmodcore'
9-
version '0.1.0'
9+
//version '0.1.0'
1010
sourceCompatibility = 1.8
1111

12+
configurations {
13+
shade
14+
implementation.extendsFrom shade
15+
}
16+
1217
repositories {
1318
mavenCentral()
1419
}
1520

1621
dependencies {
17-
implementation 'org.apache.commons:commons-io:1.3.2'
18-
implementation 'com.google.code.gson:gson:2.8.6'
19-
implementation 'org.eclipse.jgit:org.eclipse.jgit:5.13.1.202206130422-r'
20-
implementation 'org.eclipse.jgit:org.eclipse.jgit.ssh.apache:5.13.2.202306221912-r'
22+
shade 'org.apache.commons:commons-io:1.3.2'
23+
shade 'com.google.code.gson:gson:2.8.6'
24+
shade 'org.eclipse.jgit:org.eclipse.jgit:5.13.1.202206130422-r'
25+
shade 'org.eclipse.jgit:org.eclipse.jgit.ssh.apache:5.13.2.202306221912-r'
2126
}
2227

28+
shadowJar {
29+
archiveClassifier = ''
30+
configurations = [project.configurations.shade]
31+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
32+
mergeServiceFiles()
33+
}
34+
35+
assemble.dependsOn shadowJar
36+
2337
jar {
2438
manifest {
2539
attributes(

src/main/java/cam72cam/universalmodcore/Setup.java

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,7 @@ public static void main(String[] args) throws IOException, GitAPIException {
3636
}
3737
String version = split[0];
3838
Loader brand = Loader.parse(split[1]);
39-
String intermediary = version;
40-
41-
if (intermediary.startsWith("1.")) {
42-
intermediary = intermediary.substring(2);
43-
}
44-
45-
if (!intermediary.matches("\\d*\\.\\d*")) {
46-
System.err.println("Invalid Minecraft version: " + version + ", it should be 1.xx.xx for 1.21.11 and below or xx.x for 26.1 and up");
39+
if (!isValidVersion(version)) {
4740
return;
4841
}
4942

@@ -121,4 +114,24 @@ public static void main(String[] args) throws IOException, GitAPIException {
121114
);
122115
}
123116
}
117+
118+
private static boolean isValidVersion(String version) {
119+
String intermediary = version;
120+
121+
if (intermediary.startsWith("1.")) {
122+
intermediary = intermediary.substring(2);
123+
// Up to 1.21
124+
if (!intermediary.matches("([7-9]|1[0-9]|20|21)(\\.\\d+)*")) {
125+
System.err.println("Invalid minecraft version: " + version + ", it should be 1.xx.xx for 1.21.11 and below, and above or equals to 1.7.10");
126+
return false;
127+
}
128+
} else {
129+
//Start from 26.1
130+
if (!intermediary.matches("(2[6-9]|[3-9]\\d)(\\.\\d+)+")) {
131+
System.err.println("Invalid minecraft version: " + version + ", it should be xx.x for 26.1 and up");
132+
return false;
133+
}
134+
}
135+
return true;
136+
}
124137
}

0 commit comments

Comments
 (0)