Commit a954d09eb8c71993f66803c90d283ee6c519ca5b

Authored by Mumfrey
1 parent 13aabe4b

Add timestamp for release build

java/common/com/mumfrey/liteloader/core/LiteLoaderVersion.java
1 -package com.mumfrey.liteloader.core;  
2 -  
3 -import java.util.HashSet;  
4 -import java.util.Set;  
5 -  
6 -/**  
7 - * LiteLoader version table  
8 - *  
9 - * @author Adam Mummery-Smith  
10 - * @version 1.8.0_00  
11 - */  
12 -public enum LiteLoaderVersion  
13 -{  
14 - LEGACY(0, 0, "-", "Unknown", "-"),  
15 - FUTURE(Integer.MAX_VALUE, Long.MAX_VALUE, "-", "Future", "-"),  
16 -  
17 - MC_1_5_2_R1(9, 0, "1.5.2", "1.5.2", "1.5.2" ),  
18 - MC_1_6_1_R0(11, 0, "1.6.1", "1.6.1", "1.6.1", "1.6.r1"),  
19 - MC_1_6_1_R1(11, 0, "1.6.1", "1.6.1", "1.6.1", "1.6.r1"),  
20 - MC_1_6_2_R0(12, 0, "1.6.2", "1.6.2", "1.6.2", "1.6.r2"),  
21 - MC_1_6_2_R1(12, 1374025480, "1.6.2", "1.6.2_01", "1.6.2", "1.6.r2"),  
22 - MC_1_6_2_R2(13, 1374709543, "1.6.2", "1.6.2_02", "1.6.2", "1.6.r2"),  
23 - MC_1_6_2_R3(14, 1375228794, "1.6.2", "1.6.2_03", "1.6.2", "1.6.r2"),  
24 - MC_1_6_2_R4(15, 1375662298, "1.6.2", "1.6.2_04", "1.6.2", "1.6.r2"),  
25 - MC_1_6_3_R0(16, 1375662298, "1.6.3", "1.6.3", "1.6.3", "1.6.r3"),  
26 - MC_1_6_4_R0(17, 1380279938, "1.6.4", "1.6.4", "1.6.4", "1.6.r4"),  
27 - MC_1_6_4_R1(18, 1380796916, "1.6.4", "1.6.4_01", "1.6.4", "1.6.r4"),  
28 - MC_1_6_4_R2(19, 1380796916, "1.6.4", "1.6.4_02", "1.6.4", "1.6.r4"),  
29 - MC_1_7_2_R0(20, 1386027226, "1.7.2", "1.7.2", "1.7.2", "1.7.r1"),  
30 - MC_1_7_2_R1(21, 1388455995, "1.7.2", "1.7.2_01", "1.7.2_01"),  
31 - MC_1_7_2_R2(22, 1391815963, "1.7.2", "1.7.2_02", "1.7.2_02"),  
32 - MC_1_7_2_R3(23, 1391890695, "1.7.2", "1.7.2_03", "1.7.2_02", "1.7.2_03"),  
33 - MC_1_7_2_R4(24, 1392487926, "1.7.2", "1.7.2_04", "1.7.2_02", "1.7.2_03", "1.7.2_04"),  
34 - MC_1_7_2_R5(25, 0, "1.7.2", "1.7.2_05", "1.7.2_02", "1.7.2_03", "1.7.2_04", "1.7.2_05"),  
35 - MC_1_7_2_R6(26, 0, "1.7.2", "1.7.2_06", "1.7.2_06"),  
36 - MC_1_7_10_R0(27, 1404330030, "1.7.10", "1.7.10", "1.7.10"),  
37 - MC_1_7_10_R1(28, 1404673785, "1.7.10", "1.7.10_01", "1.7.10"),  
38 - MC_1_7_10_R2(29, 1405369406, "1.7.10", "1.7.10_02", "1.7.10"),  
39 - MC_1_7_10_R3(30, 1407687918, "1.7.10", "1.7.10_03", "1.7.10", "1.7.10_03"),  
40 - MC_1_7_10_R4(31, 1414368553, "1.7.10", "1.7.10_04", "1.7.10", "1.7.10_03", "1.7.10_04"),  
41 - MC_1_8_0_R0(32, 0, "1.8", "1.8.0", "1.8", "1.8.0");  
42 -  
43 - /**  
44 - * Current loader version  
45 - */  
46 - public static final LiteLoaderVersion CURRENT = LiteLoaderVersion.MC_1_8_0_R0;  
47 -  
48 - private static final LiteLoaderUpdateSite updateSite = new LiteLoaderUpdateSite(LiteLoaderVersion.CURRENT.getMinecraftVersion(), LiteLoaderVersion.CURRENT.getReleaseTimestamp());  
49 -  
50 - private final int revision;  
51 -  
52 - private final long timestamp;  
53 -  
54 - private final String minecraftVersion;  
55 -  
56 - private final String loaderVersion;  
57 -  
58 - private final Set<String> supportedVersions = new HashSet<String>();  
59 -  
60 - private LiteLoaderVersion(int revision, long timestamp, String minecraftVersion, String loaderVersion, String... supportedVersions)  
61 - {  
62 - this.revision = revision;  
63 - this.timestamp = timestamp;  
64 - this.minecraftVersion = minecraftVersion;  
65 - this.loaderVersion = loaderVersion;  
66 -  
67 - for (String supportedVersion : supportedVersions)  
68 - this.supportedVersions.add(supportedVersion);  
69 - }  
70 -  
71 - public int getLoaderRevision()  
72 - {  
73 - return this.revision;  
74 - }  
75 -  
76 - public long getReleaseTimestamp()  
77 - {  
78 - return this.timestamp;  
79 - }  
80 -  
81 - public String getMinecraftVersion()  
82 - {  
83 - return this.minecraftVersion;  
84 - }  
85 -  
86 - public String getLoaderVersion()  
87 - {  
88 - return this.loaderVersion;  
89 - }  
90 -  
91 - public static LiteLoaderVersion getVersionFromRevision(int revision)  
92 - {  
93 - if (revision > LiteLoaderVersion.CURRENT.revision)  
94 - {  
95 - return LiteLoaderVersion.FUTURE;  
96 - }  
97 -  
98 - for (LiteLoaderVersion version : LiteLoaderVersion.values())  
99 - {  
100 - if (version.getLoaderRevision() == revision)  
101 - return version;  
102 - }  
103 -  
104 - return LiteLoaderVersion.LEGACY;  
105 - }  
106 -  
107 - public static int getRevisionFromVersion(String versionString)  
108 - {  
109 - for (LiteLoaderVersion version : LiteLoaderVersion.values())  
110 - {  
111 - if (version.getLoaderVersion().equals(versionString))  
112 - return version.getLoaderRevision();  
113 - }  
114 -  
115 - return LiteLoaderVersion.LEGACY.getLoaderRevision();  
116 - }  
117 -  
118 - public boolean isVersionSupported(String version)  
119 - {  
120 - return this.supportedVersions.contains(version);  
121 - }  
122 -  
123 - @Override  
124 - public String toString()  
125 - {  
126 - return this.loaderVersion;  
127 - }  
128 -  
129 - public static LiteLoaderUpdateSite getUpdateSite()  
130 - {  
131 - return LiteLoaderVersion.updateSite;  
132 - }  
133 -} 1 +package com.mumfrey.liteloader.core;
  2 +
  3 +import java.util.HashSet;
  4 +import java.util.Set;
  5 +
  6 +/**
  7 + * LiteLoader version table
  8 + *
  9 + * @author Adam Mummery-Smith
  10 + * @version 1.8.0_00
  11 + */
  12 +public enum LiteLoaderVersion
  13 +{
  14 + LEGACY(0, 0, "-", "Unknown", "-"),
  15 + FUTURE(Integer.MAX_VALUE, Long.MAX_VALUE, "-", "Future", "-"),
  16 +
  17 + MC_1_5_2_R1(9, 0, "1.5.2", "1.5.2", "1.5.2" ),
  18 + MC_1_6_1_R0(11, 0, "1.6.1", "1.6.1", "1.6.1", "1.6.r1"),
  19 + MC_1_6_1_R1(11, 0, "1.6.1", "1.6.1", "1.6.1", "1.6.r1"),
  20 + MC_1_6_2_R0(12, 0, "1.6.2", "1.6.2", "1.6.2", "1.6.r2"),
  21 + MC_1_6_2_R1(12, 1374025480, "1.6.2", "1.6.2_01", "1.6.2", "1.6.r2"),
  22 + MC_1_6_2_R2(13, 1374709543, "1.6.2", "1.6.2_02", "1.6.2", "1.6.r2"),
  23 + MC_1_6_2_R3(14, 1375228794, "1.6.2", "1.6.2_03", "1.6.2", "1.6.r2"),
  24 + MC_1_6_2_R4(15, 1375662298, "1.6.2", "1.6.2_04", "1.6.2", "1.6.r2"),
  25 + MC_1_6_3_R0(16, 1375662298, "1.6.3", "1.6.3", "1.6.3", "1.6.r3"),
  26 + MC_1_6_4_R0(17, 1380279938, "1.6.4", "1.6.4", "1.6.4", "1.6.r4"),
  27 + MC_1_6_4_R1(18, 1380796916, "1.6.4", "1.6.4_01", "1.6.4", "1.6.r4"),
  28 + MC_1_6_4_R2(19, 1380796916, "1.6.4", "1.6.4_02", "1.6.4", "1.6.r4"),
  29 + MC_1_7_2_R0(20, 1386027226, "1.7.2", "1.7.2", "1.7.2", "1.7.r1"),
  30 + MC_1_7_2_R1(21, 1388455995, "1.7.2", "1.7.2_01", "1.7.2_01"),
  31 + MC_1_7_2_R2(22, 1391815963, "1.7.2", "1.7.2_02", "1.7.2_02"),
  32 + MC_1_7_2_R3(23, 1391890695, "1.7.2", "1.7.2_03", "1.7.2_02", "1.7.2_03"),
  33 + MC_1_7_2_R4(24, 1392487926, "1.7.2", "1.7.2_04", "1.7.2_02", "1.7.2_03", "1.7.2_04"),
  34 + MC_1_7_2_R5(25, 0, "1.7.2", "1.7.2_05", "1.7.2_02", "1.7.2_03", "1.7.2_04", "1.7.2_05"),
  35 + MC_1_7_2_R6(26, 0, "1.7.2", "1.7.2_06", "1.7.2_06"),
  36 + MC_1_7_10_R0(27, 1404330030, "1.7.10", "1.7.10", "1.7.10"),
  37 + MC_1_7_10_R1(28, 1404673785, "1.7.10", "1.7.10_01", "1.7.10"),
  38 + MC_1_7_10_R2(29, 1405369406, "1.7.10", "1.7.10_02", "1.7.10"),
  39 + MC_1_7_10_R3(30, 1407687918, "1.7.10", "1.7.10_03", "1.7.10", "1.7.10_03"),
  40 + MC_1_7_10_R4(31, 1414368553, "1.7.10", "1.7.10_04", "1.7.10", "1.7.10_03", "1.7.10_04"),
  41 + MC_1_8_0_R0(32, 1463585254, "1.8", "1.8.0", "1.8", "1.8.0");
  42 +
  43 + /**
  44 + * Current loader version
  45 + */
  46 + public static final LiteLoaderVersion CURRENT = LiteLoaderVersion.MC_1_8_0_R0;
  47 +
  48 + private static final LiteLoaderUpdateSite updateSite = new LiteLoaderUpdateSite(LiteLoaderVersion.CURRENT.getMinecraftVersion(), LiteLoaderVersion.CURRENT.getReleaseTimestamp());
  49 +
  50 + private final int revision;
  51 +
  52 + private final long timestamp;
  53 +
  54 + private final String minecraftVersion;
  55 +
  56 + private final String loaderVersion;
  57 +
  58 + private final Set<String> supportedVersions = new HashSet<String>();
  59 +
  60 + private LiteLoaderVersion(int revision, long timestamp, String minecraftVersion, String loaderVersion, String... supportedVersions)
  61 + {
  62 + this.revision = revision;
  63 + this.timestamp = timestamp;
  64 + this.minecraftVersion = minecraftVersion;
  65 + this.loaderVersion = loaderVersion;
  66 +
  67 + for (String supportedVersion : supportedVersions)
  68 + this.supportedVersions.add(supportedVersion);
  69 + }
  70 +
  71 + public int getLoaderRevision()
  72 + {
  73 + return this.revision;
  74 + }
  75 +
  76 + public long getReleaseTimestamp()
  77 + {
  78 + return this.timestamp;
  79 + }
  80 +
  81 + public String getMinecraftVersion()
  82 + {
  83 + return this.minecraftVersion;
  84 + }
  85 +
  86 + public String getLoaderVersion()
  87 + {
  88 + return this.loaderVersion;
  89 + }
  90 +
  91 + public static LiteLoaderVersion getVersionFromRevision(int revision)
  92 + {
  93 + if (revision > LiteLoaderVersion.CURRENT.revision)
  94 + {
  95 + return LiteLoaderVersion.FUTURE;
  96 + }
  97 +
  98 + for (LiteLoaderVersion version : LiteLoaderVersion.values())
  99 + {
  100 + if (version.getLoaderRevision() == revision)
  101 + return version;
  102 + }
  103 +
  104 + return LiteLoaderVersion.LEGACY;
  105 + }
  106 +
  107 + public static int getRevisionFromVersion(String versionString)
  108 + {
  109 + for (LiteLoaderVersion version : LiteLoaderVersion.values())
  110 + {
  111 + if (version.getLoaderVersion().equals(versionString))
  112 + return version.getLoaderRevision();
  113 + }
  114 +
  115 + return LiteLoaderVersion.LEGACY.getLoaderRevision();
  116 + }
  117 +
  118 + public boolean isVersionSupported(String version)
  119 + {
  120 + return this.supportedVersions.contains(version);
  121 + }
  122 +
  123 + @Override
  124 + public String toString()
  125 + {
  126 + return this.loaderVersion;
  127 + }
  128 +
  129 + public static LiteLoaderUpdateSite getUpdateSite()
  130 + {
  131 + return LiteLoaderVersion.updateSite;
  132 + }
  133 +}