mirror of
https://github.com/AppleDash/SaneEconomy.git
synced 2024-09-29 23:17:30 +02:00
0.12.7 - Fix version comparator AGAIN
This commit is contained in:
parent
31d311c229
commit
9a00cddf24
@ -9,7 +9,7 @@
|
|||||||
<version>0</version>
|
<version>0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>SaneEconomyCore</artifactId>
|
<artifactId>SaneEconomyCore</artifactId>
|
||||||
<version>0.12.6-SNAPSHOT</version>
|
<version>0.12.7-SNAPSHOT</version>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -17,15 +17,7 @@ public class VersionComparer {
|
|||||||
int[] firstParts = intifyParts(first);
|
int[] firstParts = intifyParts(first);
|
||||||
int[] secondParts = intifyParts(second);
|
int[] secondParts = intifyParts(second);
|
||||||
|
|
||||||
if (secondParts[0] > firstParts[0]) {
|
return computeInt(secondParts) > computeInt(firstParts);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (secondParts[1] > firstParts[1]) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return secondParts[2] > firstParts[2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int[] intifyParts(String version) {
|
private static int[] intifyParts(String version) {
|
||||||
@ -33,4 +25,8 @@ public class VersionComparer {
|
|||||||
|
|
||||||
return new int[] { Integer.valueOf(firstParts[0]), Integer.valueOf(firstParts[1]), Integer.valueOf(firstParts[2]) };
|
return new int[] { Integer.valueOf(firstParts[0]), Integer.valueOf(firstParts[1]), Integer.valueOf(firstParts[2]) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int computeInt(int[] parts) {
|
||||||
|
return (parts[0] * 1000000) + (parts[1] * 1000) + parts[2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name: SaneEconomy
|
name: SaneEconomy
|
||||||
author: AppleDash
|
author: AppleDash
|
||||||
main: org.appledash.saneeconomy.SaneEconomy
|
main: org.appledash.saneeconomy.SaneEconomy
|
||||||
version: 0.12.6
|
version: 0.12.7
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
softdepend: [Vault]
|
softdepend: [Vault]
|
||||||
commands:
|
commands:
|
||||||
|
@ -15,5 +15,6 @@ public class VersionComparerTest {
|
|||||||
Assert.assertFalse(VersionComparer.isSemVerGreaterThan("2.0.0", "1.0.0"));
|
Assert.assertFalse(VersionComparer.isSemVerGreaterThan("2.0.0", "1.0.0"));
|
||||||
Assert.assertTrue(VersionComparer.isSemVerGreaterThan("0.1.0", "0.2.0"));
|
Assert.assertTrue(VersionComparer.isSemVerGreaterThan("0.1.0", "0.2.0"));
|
||||||
Assert.assertTrue(VersionComparer.isSemVerGreaterThan("1.0.0", "2.0.0"));
|
Assert.assertTrue(VersionComparer.isSemVerGreaterThan("1.0.0", "2.0.0"));
|
||||||
|
Assert.assertFalse(VersionComparer.isSemVerGreaterThan("0.12.6", "0.5.7"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.appledash</groupId>
|
<groupId>org.appledash</groupId>
|
||||||
<artifactId>SaneEconomyCore</artifactId>
|
<artifactId>SaneEconomyCore</artifactId>
|
||||||
<version>0.12.6-SNAPSHOT</version>
|
<version>0.12.7-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.appledash</groupId>
|
<groupId>org.appledash</groupId>
|
||||||
<artifactId>SaneEconomyCore</artifactId>
|
<artifactId>SaneEconomyCore</artifactId>
|
||||||
<version>0.12.6-SNAPSHOT</version>
|
<version>0.12.7-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.appledash</groupId>
|
<groupId>org.appledash</groupId>
|
||||||
<artifactId>SaneEconomyCore</artifactId>
|
<artifactId>SaneEconomyCore</artifactId>
|
||||||
<version>0.12.6-SNAPSHOT</version>
|
<version>0.12.7-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user