mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 02:08:27 +01:00
Add a way to parse (non-extended) layered versions
This commit is contained in:
parent
12a74b3474
commit
eb9bf034b4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -710,6 +710,10 @@
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Bungee/Host/Internal/InternalHost.html#forceRemoveSubServer-java.util.UUID-java.lang.String-">forceRemoveSubServer(UUID, String)</a></span> - Method in class net.ME1312.SubServers.Bungee.Host.Internal.<a href="net/ME1312/SubServers/Bungee/Host/Internal/InternalHost.html" title="class in net.ME1312.SubServers.Bungee.Host.Internal">InternalHost</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Bungee/Library/Version/Version.html#fromString-java.lang.String-">fromString(String)</a></span> - Static method in class net.ME1312.SubServers.Bungee.Library.Version.<a href="net/ME1312/SubServers/Bungee/Library/Version/Version.html" title="class in net.ME1312.SubServers.Bungee.Library.Version">Version</a></dt>
|
||||
<dd>
|
||||
<div class="block">Parse a Version from a string</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<a name="I:G">
|
||||
<!-- -->
|
||||
|
@ -17,7 +17,7 @@
|
||||
catch(err) {
|
||||
}
|
||||
//-->
|
||||
var methods = {"i0":9,"i1":10,"i2":10,"i3":10,"i4":9,"i5":10,"i6":10,"i7":10,"i8":10};
|
||||
var methods = {"i0":9,"i1":10,"i2":10,"i3":10,"i4":9,"i5":9,"i6":10,"i7":10,"i8":10,"i9":10};
|
||||
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
||||
var altColor = "altColor";
|
||||
var rowColor = "rowColor";
|
||||
@ -249,6 +249,12 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i5" class="rowColor">
|
||||
<td class="colFirst"><code>static <a href="../../../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html" title="class in net.ME1312.SubServers.Bungee.Library.Version">Version</a></code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html#fromString-java.lang.String-">fromString</a></span>(java.lang.String string)</code>
|
||||
<div class="block">Parse a Version from a string</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i6" class="altColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html#toExtendedString--">toExtendedString</a></span>()</code>
|
||||
<div class="block">The extended toString() method<br>
|
||||
@ -257,7 +263,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<b>1.0.0 pre-alpha 7</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i6" class="altColor">
|
||||
<tr id="i7" class="rowColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html#toFullExtendedString--">toFullExtendedString</a></span>()</code>
|
||||
<div class="block">The full extended toString() method<br>
|
||||
@ -266,7 +272,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<b>release 1.0.0 pre-alpha 7</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i7" class="rowColor">
|
||||
<tr id="i8" class="altColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html#toFullString--">toFullString</a></span>()</code>
|
||||
<div class="block">The full toString() method<br>
|
||||
@ -275,7 +281,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<b>r1.0.0/pa7</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i8" class="altColor">
|
||||
<tr id="i9" class="rowColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html#toString--">toString</a></span>()</code>
|
||||
<div class="block">The default toString() method<br>
|
||||
@ -442,6 +448,22 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Method Detail</h3>
|
||||
<a name="fromString-java.lang.String-">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>fromString</h4>
|
||||
<pre>public static <a href="../../../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html" title="class in net.ME1312.SubServers.Bungee.Library.Version">Version</a> fromString(java.lang.String string)</pre>
|
||||
<div class="block">Parse a Version from a string</div>
|
||||
<dl>
|
||||
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||
<dd><code>string</code> - String to parse</dd>
|
||||
<dt><span class="seeLabel">See Also:</span></dt>
|
||||
<dd><a href="../../../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html#toFullString--"><code>for a valid string value</code></a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="toString--">
|
||||
<!-- -->
|
||||
</a>
|
||||
|
Binary file not shown.
@ -425,6 +425,10 @@
|
||||
<dd>
|
||||
<div class="block">Forward Packet to Client</div>
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html#fromString-java.lang.String-">fromString(String)</a></span> - Static method in class net.ME1312.SubServers.Client.Bukkit.Library.Version.<a href="net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version">Version</a></dt>
|
||||
<dd>
|
||||
<div class="block">Parse a Version from a string</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<a name="I:G">
|
||||
<!-- -->
|
||||
|
@ -17,7 +17,7 @@
|
||||
catch(err) {
|
||||
}
|
||||
//-->
|
||||
var methods = {"i0":9,"i1":10,"i2":10,"i3":10,"i4":9,"i5":10,"i6":10,"i7":10,"i8":10};
|
||||
var methods = {"i0":9,"i1":10,"i2":10,"i3":10,"i4":9,"i5":9,"i6":10,"i7":10,"i8":10,"i9":10};
|
||||
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
||||
var altColor = "altColor";
|
||||
var rowColor = "rowColor";
|
||||
@ -249,6 +249,12 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i5" class="rowColor">
|
||||
<td class="colFirst"><code>static <a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version">Version</a></code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html#fromString-java.lang.String-">fromString</a></span>(java.lang.String string)</code>
|
||||
<div class="block">Parse a Version from a string</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i6" class="altColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html#toExtendedString--">toExtendedString</a></span>()</code>
|
||||
<div class="block">The extended toString() method<br>
|
||||
@ -257,7 +263,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<b>1.0.0 pre-alpha 7</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i6" class="altColor">
|
||||
<tr id="i7" class="rowColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html#toFullExtendedString--">toFullExtendedString</a></span>()</code>
|
||||
<div class="block">The full extended toString() method<br>
|
||||
@ -266,7 +272,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<b>release 1.0.0 pre-alpha 7</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i7" class="rowColor">
|
||||
<tr id="i8" class="altColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html#toFullString--">toFullString</a></span>()</code>
|
||||
<div class="block">The full toString() method<br>
|
||||
@ -275,7 +281,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<b>r1.0.0/pa7</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i8" class="altColor">
|
||||
<tr id="i9" class="rowColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html#toString--">toString</a></span>()</code>
|
||||
<div class="block">The default toString() method<br>
|
||||
@ -442,6 +448,22 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Method Detail</h3>
|
||||
<a name="fromString-java.lang.String-">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>fromString</h4>
|
||||
<pre>public static <a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version">Version</a> fromString(java.lang.String string)</pre>
|
||||
<div class="block">Parse a Version from a string</div>
|
||||
<dl>
|
||||
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||
<dd><code>string</code> - String to parse</dd>
|
||||
<dt><span class="seeLabel">See Also:</span></dt>
|
||||
<dd><a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html#toFullString--"><code>for a valid string value</code></a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="toString--">
|
||||
<!-- -->
|
||||
</a>
|
||||
|
Binary file not shown.
@ -527,6 +527,10 @@
|
||||
<dd>
|
||||
<div class="block">Forward Packet to Server</div>
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Host/Library/Version/Version.html#fromString-java.lang.String-">fromString(String)</a></span> - Static method in class net.ME1312.SubServers.Host.Library.Version.<a href="net/ME1312/SubServers/Host/Library/Version/Version.html" title="class in net.ME1312.SubServers.Host.Library.Version">Version</a></dt>
|
||||
<dd>
|
||||
<div class="block">Parse a Version from a string</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<a name="I:G">
|
||||
<!-- -->
|
||||
|
@ -17,7 +17,7 @@
|
||||
catch(err) {
|
||||
}
|
||||
//-->
|
||||
var methods = {"i0":9,"i1":10,"i2":10,"i3":10,"i4":9,"i5":10,"i6":10,"i7":10,"i8":10};
|
||||
var methods = {"i0":9,"i1":10,"i2":10,"i3":10,"i4":9,"i5":9,"i6":10,"i7":10,"i8":10,"i9":10};
|
||||
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
||||
var altColor = "altColor";
|
||||
var rowColor = "rowColor";
|
||||
@ -249,6 +249,12 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i5" class="rowColor">
|
||||
<td class="colFirst"><code>static <a href="../../../../../../net/ME1312/SubServers/Host/Library/Version/Version.html" title="class in net.ME1312.SubServers.Host.Library.Version">Version</a></code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Host/Library/Version/Version.html#fromString-java.lang.String-">fromString</a></span>(java.lang.String string)</code>
|
||||
<div class="block">Parse a Version from a string</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i6" class="altColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Host/Library/Version/Version.html#toExtendedString--">toExtendedString</a></span>()</code>
|
||||
<div class="block">The extended toString() method<br>
|
||||
@ -257,7 +263,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<b>1.0.0 pre-alpha 7</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i6" class="altColor">
|
||||
<tr id="i7" class="rowColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Host/Library/Version/Version.html#toFullExtendedString--">toFullExtendedString</a></span>()</code>
|
||||
<div class="block">The full extended toString() method<br>
|
||||
@ -266,7 +272,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<b>release 1.0.0 pre-alpha 7</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i7" class="rowColor">
|
||||
<tr id="i8" class="altColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Host/Library/Version/Version.html#toFullString--">toFullString</a></span>()</code>
|
||||
<div class="block">The full toString() method<br>
|
||||
@ -275,7 +281,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<b>r1.0.0/pa7</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i8" class="altColor">
|
||||
<tr id="i9" class="rowColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Host/Library/Version/Version.html#toString--">toString</a></span>()</code>
|
||||
<div class="block">The default toString() method<br>
|
||||
@ -442,6 +448,22 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Method Detail</h3>
|
||||
<a name="fromString-java.lang.String-">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>fromString</h4>
|
||||
<pre>public static <a href="../../../../../../net/ME1312/SubServers/Host/Library/Version/Version.html" title="class in net.ME1312.SubServers.Host.Library.Version">Version</a> fromString(java.lang.String string)</pre>
|
||||
<div class="block">Parse a Version from a string</div>
|
||||
<dl>
|
||||
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||
<dd><code>string</code> - String to parse</dd>
|
||||
<dt><span class="seeLabel">See Also:</span></dt>
|
||||
<dd><a href="../../../../../../net/ME1312/SubServers/Host/Library/Version/Version.html#toFullString--"><code>for a valid string value</code></a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="toString--">
|
||||
<!-- -->
|
||||
</a>
|
||||
|
Binary file not shown.
@ -423,6 +423,10 @@
|
||||
<dd>
|
||||
<div class="block">Forward Packet to Client</div>
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Sync/Library/Version/Version.html#fromString-java.lang.String-">fromString(String)</a></span> - Static method in class net.ME1312.SubServers.Sync.Library.Version.<a href="net/ME1312/SubServers/Sync/Library/Version/Version.html" title="class in net.ME1312.SubServers.Sync.Library.Version">Version</a></dt>
|
||||
<dd>
|
||||
<div class="block">Parse a Version from a string</div>
|
||||
</dd>
|
||||
</dl>
|
||||
<a name="I:G">
|
||||
<!-- -->
|
||||
|
@ -17,7 +17,7 @@
|
||||
catch(err) {
|
||||
}
|
||||
//-->
|
||||
var methods = {"i0":9,"i1":10,"i2":10,"i3":10,"i4":9,"i5":10,"i6":10,"i7":10,"i8":10};
|
||||
var methods = {"i0":9,"i1":10,"i2":10,"i3":10,"i4":9,"i5":9,"i6":10,"i7":10,"i8":10,"i9":10};
|
||||
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
||||
var altColor = "altColor";
|
||||
var rowColor = "rowColor";
|
||||
@ -249,6 +249,12 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i5" class="rowColor">
|
||||
<td class="colFirst"><code>static <a href="../../../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html" title="class in net.ME1312.SubServers.Sync.Library.Version">Version</a></code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html#fromString-java.lang.String-">fromString</a></span>(java.lang.String string)</code>
|
||||
<div class="block">Parse a Version from a string</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i6" class="altColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html#toExtendedString--">toExtendedString</a></span>()</code>
|
||||
<div class="block">The extended toString() method<br>
|
||||
@ -257,7 +263,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<b>1.0.0 pre-alpha 7</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i6" class="altColor">
|
||||
<tr id="i7" class="rowColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html#toFullExtendedString--">toFullExtendedString</a></span>()</code>
|
||||
<div class="block">The full extended toString() method<br>
|
||||
@ -266,7 +272,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<b>release 1.0.0 pre-alpha 7</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i7" class="rowColor">
|
||||
<tr id="i8" class="altColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html#toFullString--">toFullString</a></span>()</code>
|
||||
<div class="block">The full toString() method<br>
|
||||
@ -275,7 +281,7 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<b>r1.0.0/pa7</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i8" class="altColor">
|
||||
<tr id="i9" class="rowColor">
|
||||
<td class="colFirst"><code>java.lang.String</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html#toString--">toString</a></span>()</code>
|
||||
<div class="block">The default toString() method<br>
|
||||
@ -442,6 +448,22 @@ implements java.io.Serializable, java.lang.Comparable<<a href="../../../../..
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Method Detail</h3>
|
||||
<a name="fromString-java.lang.String-">
|
||||
<!-- -->
|
||||
</a>
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>fromString</h4>
|
||||
<pre>public static <a href="../../../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html" title="class in net.ME1312.SubServers.Sync.Library.Version">Version</a> fromString(java.lang.String string)</pre>
|
||||
<div class="block">Parse a Version from a string</div>
|
||||
<dl>
|
||||
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||
<dd><code>string</code> - String to parse</dd>
|
||||
<dt><span class="seeLabel">See Also:</span></dt>
|
||||
<dd><a href="../../../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html#toFullString--"><code>for a valid string value</code></a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="toString--">
|
||||
<!-- -->
|
||||
</a>
|
||||
|
Binary file not shown.
@ -31,7 +31,7 @@ Lang:
|
||||
'Command.Help.SubServer.Terminate': ' &7Terminate Server:&f $str$'
|
||||
'Command.Help.SubServer.Command': ' &7Command Server:&f $str$'
|
||||
'Command.Version': '&7SubServers &8&l\u00BB&7 $name$ is running version &f$str$'
|
||||
'Command.Version.Outdated': '&7You are $int$ version(s) behind.'
|
||||
'Command.Version.Outdated': '&7$name$ &f$str$ &7is available. You are $int$ version(s) behind.'
|
||||
'Command.Version.Latest': '&7You are on the latest version.'
|
||||
'Command.List.Group-Header': '&7SubServers &8&l\u00BB&7 Group/Server List:'
|
||||
'Command.List.Host-Header': '&7SubServers &8&l\u00BB&7 Host/SubServer List:'
|
||||
|
@ -3,6 +3,10 @@ package net.ME1312.SubServers.Bungee.Library.Version;
|
||||
import net.ME1312.SubServers.Bungee.Library.Util;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Version Class
|
||||
@ -22,10 +26,10 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
PRE_RELEASE(4, "pr", "pre-release"),
|
||||
RELEASE(5, "r", "release");
|
||||
|
||||
private final int id;
|
||||
private final short stageid;
|
||||
private final String shortname, longname;
|
||||
VersionType(int id, String shortname, String longname) {
|
||||
this.id = id;
|
||||
VersionType(int stageid, String shortname, String longname) {
|
||||
this.stageid = (short) stageid;
|
||||
this.shortname = shortname;
|
||||
this.longname = longname;
|
||||
}
|
||||
@ -125,6 +129,42 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a Version from a string
|
||||
*
|
||||
* @param string String to parse
|
||||
* @see #toFullString() for a valid string value
|
||||
*/
|
||||
public static Version fromString(String string) {
|
||||
Matcher regex = Pattern.compile("(p?[abr])?([^/]+)").matcher(string);
|
||||
Version current = null;
|
||||
while (regex.find()) {
|
||||
try {
|
||||
VersionType type = VersionType.RELEASE;
|
||||
if (regex.group(1) != null) switch (regex.group(1).toLowerCase()) {
|
||||
case "pa":
|
||||
type = VersionType.PRE_ALPHA;
|
||||
break;
|
||||
case "a":
|
||||
type = VersionType.ALPHA;
|
||||
break;
|
||||
case "pb":
|
||||
type = VersionType.PRE_BETA;
|
||||
break;
|
||||
case "b":
|
||||
type = VersionType.BETA;
|
||||
break;
|
||||
case "pr":
|
||||
type = VersionType.PRE_RELEASE;
|
||||
break;
|
||||
}
|
||||
current = new Version(current, type, regex.group(2));
|
||||
} catch (Throwable e) {}
|
||||
}
|
||||
if (current == null) throw new IllegalArgumentException("Could not find version in string: " + string);
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default toString() method<br>
|
||||
* <br>
|
||||
@ -212,21 +252,82 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
* @param version The version to compare to
|
||||
*/
|
||||
public int compareTo(Version version) {
|
||||
// Compare parent versions first
|
||||
if (this.parent != null || version.parent != null) {
|
||||
int parent = ((this.parent == null)?this:this.parent).compareTo((version.parent == null)?version:version.parent);
|
||||
if (parent != 0) return parent;
|
||||
return compare(this, version);
|
||||
}
|
||||
|
||||
/**
|
||||
* See if Versions are Equal
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
* @return
|
||||
*/
|
||||
public static boolean equals(Version ver1, Version ver2) {
|
||||
return compare(ver1, ver2) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if Greater than
|
||||
* Returns 0 if Equal
|
||||
* Returns -1 if Less than
|
||||
*//**
|
||||
* Compare Versions
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
*/
|
||||
public static int compare(Version ver1, Version ver2) {
|
||||
LinkedList<Version> stack1 = new LinkedList<Version>(), stack2 = new LinkedList<Version>();
|
||||
if (ver1 != null) {
|
||||
stack1.add(ver1);
|
||||
while (ver1.parent != null) {
|
||||
ver1 = ver1.parent;
|
||||
stack1.add(ver1);
|
||||
}
|
||||
Collections.reverse(stack1);
|
||||
}
|
||||
if (ver2 != null) {
|
||||
stack2.add(ver2);
|
||||
while (ver2.parent != null) {
|
||||
ver2 = ver2.parent;
|
||||
stack2.add(ver2);
|
||||
}
|
||||
Collections.reverse(stack2);
|
||||
}
|
||||
|
||||
if (this.parent != null && version.parent == null) {
|
||||
// Version one has a parent version and version two does not, making version two the official version
|
||||
return -1;
|
||||
}
|
||||
int id;
|
||||
for (id = 0; id < stack1.size(); id++) {
|
||||
if (id >= stack2.size()) {
|
||||
// Version one still has children when version two does not, making version two the official version
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (this.parent == null && version.parent != null) {
|
||||
// Version one does not have a parent version and version two does, making version one the official version
|
||||
int result = stack1.get(id).compare(stack2.get(id));
|
||||
if (result != 0) {
|
||||
// Versions are not the same, return the result
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (id < stack2.size()) {
|
||||
// Version one does not children when version two still does, making version one the official version
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compares versions ignoring parent/child relationships
|
||||
*/
|
||||
private int compare(Version version) {
|
||||
if (this.type.stageid > version.type.stageid) {
|
||||
// Version one has a type of a later stage than version two
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (this.type.stageid < version.type.stageid) {
|
||||
// Version one has a type of an earlier stage than version two
|
||||
return -1;
|
||||
}
|
||||
|
||||
VersionTokenizer tokenizer1 = new VersionTokenizer(string);
|
||||
VersionTokenizer tokenizer2 = new VersionTokenizer(version.string);
|
||||
@ -292,29 +393,4 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* See if Versions are Equal
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
* @return
|
||||
*/
|
||||
public static boolean equals(Version ver1, Version ver2) {
|
||||
return compare(ver1, ver2) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if Greater than
|
||||
* Returns 0 if Equal
|
||||
* Returns -1 if Less than
|
||||
*//**
|
||||
* Compare Versions
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
*/
|
||||
public static int compare(Version ver1, Version ver2) {
|
||||
return ver1.compareTo(ver2);
|
||||
}
|
||||
}
|
@ -77,8 +77,8 @@ public final class SubCommand extends CommandX {
|
||||
for (int i = 0; i < updnodeList.getLength(); i++) {
|
||||
Node node = updnodeList.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(plugin.version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = new Version(node.getTextContent());
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(plugin.version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = Version.fromString(node.getTextContent());
|
||||
updcount++;
|
||||
}
|
||||
}
|
||||
@ -86,7 +86,7 @@ public final class SubCommand extends CommandX {
|
||||
if (updcount == 0) {
|
||||
sender.sendMessage("You are on the latest version.");
|
||||
} else {
|
||||
sender.sendMessage("You are " + updcount + " version" + ((updcount == 1)?"":"s") + " behind.");
|
||||
sender.sendMessage("SubServers.Bungee v" + updversion + " is available. You are " + updcount + " version" + ((updcount == 1)?"":"s") + " behind.");
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
}).start();
|
||||
|
@ -58,7 +58,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
public SubDataServer subdata = null;
|
||||
public SubServer sudo = null;
|
||||
//public static final Version version = new Version("2.13a");
|
||||
public static final Version version = new Version(new Version("2.13a"), Version.VersionType.PRE_RELEASE, 1);
|
||||
//public static final Version version = new Version(new Version("2.13a"), Version.VersionType.BETA, 1); // TODO Beta Version Setting
|
||||
public static final Version version = new Version(new Version(new Version("2.13a"), Version.VersionType.PRE_RELEASE, 2), Version.VersionType.BETA, 1); // TODO Beta Version Setting
|
||||
|
||||
public boolean redis = false;
|
||||
public long resetDate = 0;
|
||||
@ -502,8 +503,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
for (int i = 0; i < updnodeList.getLength(); i++) {
|
||||
Node node = updnodeList.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = new Version(node.getTextContent());
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = Version.fromString(node.getTextContent());
|
||||
updcount++;
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@ -3,6 +3,10 @@ package net.ME1312.SubServers.Client.Bukkit.Library.Version;
|
||||
import net.ME1312.SubServers.Client.Bukkit.Library.Util;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Version Class
|
||||
@ -11,10 +15,10 @@ import java.io.Serializable;
|
||||
public class Version implements Serializable, Comparable<Version> {
|
||||
private final Version parent;
|
||||
private final VersionType type;
|
||||
private final String string;
|
||||
private final String string;
|
||||
|
||||
public enum VersionType {
|
||||
PRE_ALPHA(0, "pa", "pre-alpha"),
|
||||
public enum VersionType {
|
||||
PRE_ALPHA(0, "pa", "pre-alpha"),
|
||||
ALPHA(1, "a", "alpha"),
|
||||
PREVIEW(2, "pb", "preview"),
|
||||
PRE_BETA(2, "pb", "pre-beta"),
|
||||
@ -22,12 +26,12 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
PRE_RELEASE(4, "pr", "pre-release"),
|
||||
RELEASE(5, "r", "release");
|
||||
|
||||
private final int id;
|
||||
private final String shortname, longname;
|
||||
VersionType(int id, String shortname, String longname) {
|
||||
this.id = id;
|
||||
this.shortname = shortname;
|
||||
this.longname = longname;
|
||||
private final short stageid;
|
||||
private final String shortname, longname;
|
||||
VersionType(int stageid, String shortname, String longname) {
|
||||
this.stageid = (short) stageid;
|
||||
this.shortname = shortname;
|
||||
this.longname = longname;
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,9 +40,9 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
*
|
||||
* @param string Version String
|
||||
*/
|
||||
public Version(String string) {
|
||||
this(VersionType.RELEASE, string);
|
||||
}
|
||||
public Version(String string) {
|
||||
this(VersionType.RELEASE, string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Version
|
||||
@ -46,8 +50,8 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
* @param type Version Type
|
||||
* @param string Version String
|
||||
*/
|
||||
public Version(VersionType type, String string) {
|
||||
this(null, type, string);
|
||||
public Version(VersionType type, String string) {
|
||||
this(null, type, string);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,6 +129,42 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a Version from a string
|
||||
*
|
||||
* @param string String to parse
|
||||
* @see #toFullString() for a valid string value
|
||||
*/
|
||||
public static Version fromString(String string) {
|
||||
Matcher regex = Pattern.compile("(p?[abr])?([^/]+)").matcher(string);
|
||||
Version current = null;
|
||||
while (regex.find()) {
|
||||
try {
|
||||
VersionType type = VersionType.RELEASE;
|
||||
if (regex.group(1) != null) switch (regex.group(1).toLowerCase()) {
|
||||
case "pa":
|
||||
type = VersionType.PRE_ALPHA;
|
||||
break;
|
||||
case "a":
|
||||
type = VersionType.ALPHA;
|
||||
break;
|
||||
case "pb":
|
||||
type = VersionType.PRE_BETA;
|
||||
break;
|
||||
case "b":
|
||||
type = VersionType.BETA;
|
||||
break;
|
||||
case "pr":
|
||||
type = VersionType.PRE_RELEASE;
|
||||
break;
|
||||
}
|
||||
current = new Version(current, type, regex.group(2));
|
||||
} catch (Throwable e) {}
|
||||
}
|
||||
if (current == null) throw new IllegalArgumentException("Could not find version in string: " + string);
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default toString() method<br>
|
||||
* <br>
|
||||
@ -212,21 +252,82 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
* @param version The version to compare to
|
||||
*/
|
||||
public int compareTo(Version version) {
|
||||
// Compare parent versions first
|
||||
if (this.parent != null || version.parent != null) {
|
||||
int parent = ((this.parent == null)?this:this.parent).compareTo((version.parent == null)?version:version.parent);
|
||||
if (parent != 0) return parent;
|
||||
return compare(this, version);
|
||||
}
|
||||
|
||||
/**
|
||||
* See if Versions are Equal
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
* @return
|
||||
*/
|
||||
public static boolean equals(Version ver1, Version ver2) {
|
||||
return compare(ver1, ver2) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if Greater than
|
||||
* Returns 0 if Equal
|
||||
* Returns -1 if Less than
|
||||
*//**
|
||||
* Compare Versions
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
*/
|
||||
public static int compare(Version ver1, Version ver2) {
|
||||
LinkedList<Version> stack1 = new LinkedList<Version>(), stack2 = new LinkedList<Version>();
|
||||
if (ver1 != null) {
|
||||
stack1.add(ver1);
|
||||
while (ver1.parent != null) {
|
||||
ver1 = ver1.parent;
|
||||
stack1.add(ver1);
|
||||
}
|
||||
Collections.reverse(stack1);
|
||||
}
|
||||
if (ver2 != null) {
|
||||
stack2.add(ver2);
|
||||
while (ver2.parent != null) {
|
||||
ver2 = ver2.parent;
|
||||
stack2.add(ver2);
|
||||
}
|
||||
Collections.reverse(stack2);
|
||||
}
|
||||
|
||||
if (this.parent != null && version.parent == null) {
|
||||
// Version one has a parent version and version two does not, making version two the official version
|
||||
return -1;
|
||||
}
|
||||
int id;
|
||||
for (id = 0; id < stack1.size(); id++) {
|
||||
if (id >= stack2.size()) {
|
||||
// Version one still has children when version two does not, making version two the official version
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (this.parent == null && version.parent != null) {
|
||||
// Version one does not have a parent version and version two does, making version one the official version
|
||||
int result = stack1.get(id).compare(stack2.get(id));
|
||||
if (result != 0) {
|
||||
// Versions are not the same, return the result
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (id < stack2.size()) {
|
||||
// Version one does not children when version two still does, making version one the official version
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compares versions ignoring parent/child relationships
|
||||
*/
|
||||
private int compare(Version version) {
|
||||
if (this.type.stageid > version.type.stageid) {
|
||||
// Version one has a type of a later stage than version two
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (this.type.stageid < version.type.stageid) {
|
||||
// Version one has a type of an earlier stage than version two
|
||||
return -1;
|
||||
}
|
||||
|
||||
VersionTokenizer tokenizer1 = new VersionTokenizer(string);
|
||||
VersionTokenizer tokenizer2 = new VersionTokenizer(version.string);
|
||||
@ -292,29 +393,4 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* See if Versions are Equal
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
* @return
|
||||
*/
|
||||
public static boolean equals(Version ver1, Version ver2) {
|
||||
return compare(ver1, ver2) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if Greater than
|
||||
* Returns 0 if Equal
|
||||
* Returns -1 if Less than
|
||||
*//**
|
||||
* Compare Versions
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
*/
|
||||
public static int compare(Version ver1, Version ver2) {
|
||||
return ver1.compareTo(ver2);
|
||||
}
|
||||
}
|
@ -59,8 +59,8 @@ public final class SubCommand implements CommandExecutor {
|
||||
for (int i = 0; i < updnodeList.getLength(); i++) {
|
||||
Node node = updnodeList.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(plugin.version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = new Version(node.getTextContent());
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(plugin.version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = Version.fromString(node.getTextContent());
|
||||
updcount++;
|
||||
}
|
||||
}
|
||||
@ -68,7 +68,7 @@ public final class SubCommand implements CommandExecutor {
|
||||
if (updcount == 0) {
|
||||
sender.sendMessage(plugin.api.getLang("SubServers", "Command.Version.Latest"));
|
||||
} else {
|
||||
sender.sendMessage(plugin.api.getLang("SubServers", "Command.Version.Outdated").replace("$int$", Integer.toString(updcount)));
|
||||
sender.sendMessage(plugin.api.getLang("SubServers", "Command.Version.Outdated").replace("$name$", "SubServers.Client.Bukkit").replace("$str$", updversion.toString()).replace("$int$", Integer.toString(updcount)));
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
});
|
||||
|
@ -45,7 +45,8 @@ public final class SubPlugin extends JavaPlugin {
|
||||
public SubPlugin() {
|
||||
super();
|
||||
//version = new Version(getDescription().getVersion());
|
||||
version = new Version(new Version(getDescription().getVersion()), Version.VersionType.PRE_RELEASE, 1);
|
||||
//version = new Version(new Version(getDescription().getVersion()), Version.VersionType.BETA, 1); // TODO Beta Version Setting
|
||||
version = new Version(new Version(new Version(getDescription().getVersion()), Version.VersionType.PRE_RELEASE, 2), Version.VersionType.BETA, 1); // TODO Beta Version Setting
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,8 +99,8 @@ public final class SubPlugin extends JavaPlugin {
|
||||
for (int i = 0; i < updnodeList.getLength(); i++) {
|
||||
Node node = updnodeList.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = new Version(node.getTextContent());
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = Version.fromString(node.getTextContent());
|
||||
updcount++;
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@ -58,7 +58,8 @@ public final class ExHost {
|
||||
public SubDataClient subdata = null;
|
||||
|
||||
//public final Version version = new Version("2.13a");
|
||||
public final Version version = new Version(new Version("2.13a"), Version.VersionType.PRE_RELEASE, 1);
|
||||
//public final Version version = new Version(new Version("2.13a"), Version.VersionType.BETA, 1); // TODO Beta Version Setting
|
||||
public final Version version = new Version(new Version(new Version("2.13a"), Version.VersionType.PRE_RELEASE, 2), Version.VersionType.BETA, 1); // TODO Beta Version Setting
|
||||
public final SubAPI api = new SubAPI(this);
|
||||
|
||||
private ConsoleReader jline;
|
||||
@ -391,8 +392,8 @@ public final class ExHost {
|
||||
for (int i = 0; i < updnodeList.getLength(); i++) {
|
||||
Node node = updnodeList.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = new Version(node.getTextContent());
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = Version.fromString(node.getTextContent());
|
||||
updcount++;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,10 @@ package net.ME1312.SubServers.Host.Library.Version;
|
||||
import net.ME1312.SubServers.Host.Library.Util;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Version Class
|
||||
@ -11,10 +15,10 @@ import java.io.Serializable;
|
||||
public class Version implements Serializable, Comparable<Version> {
|
||||
private final Version parent;
|
||||
private final VersionType type;
|
||||
private final String string;
|
||||
private final String string;
|
||||
|
||||
public enum VersionType {
|
||||
PRE_ALPHA(0, "pa", "pre-alpha"),
|
||||
public enum VersionType {
|
||||
PRE_ALPHA(0, "pa", "pre-alpha"),
|
||||
ALPHA(1, "a", "alpha"),
|
||||
PREVIEW(2, "pb", "preview"),
|
||||
PRE_BETA(2, "pb", "pre-beta"),
|
||||
@ -22,12 +26,12 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
PRE_RELEASE(4, "pr", "pre-release"),
|
||||
RELEASE(5, "r", "release");
|
||||
|
||||
private final int id;
|
||||
private final String shortname, longname;
|
||||
VersionType(int id, String shortname, String longname) {
|
||||
this.id = id;
|
||||
this.shortname = shortname;
|
||||
this.longname = longname;
|
||||
private final short stageid;
|
||||
private final String shortname, longname;
|
||||
VersionType(int stageid, String shortname, String longname) {
|
||||
this.stageid = (short) stageid;
|
||||
this.shortname = shortname;
|
||||
this.longname = longname;
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,9 +40,9 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
*
|
||||
* @param string Version String
|
||||
*/
|
||||
public Version(String string) {
|
||||
this(VersionType.RELEASE, string);
|
||||
}
|
||||
public Version(String string) {
|
||||
this(VersionType.RELEASE, string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Version
|
||||
@ -46,8 +50,8 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
* @param type Version Type
|
||||
* @param string Version String
|
||||
*/
|
||||
public Version(VersionType type, String string) {
|
||||
this(null, type, string);
|
||||
public Version(VersionType type, String string) {
|
||||
this(null, type, string);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,6 +129,42 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a Version from a string
|
||||
*
|
||||
* @param string String to parse
|
||||
* @see #toFullString() for a valid string value
|
||||
*/
|
||||
public static Version fromString(String string) {
|
||||
Matcher regex = Pattern.compile("(p?[abr])?([^/]+)").matcher(string);
|
||||
Version current = null;
|
||||
while (regex.find()) {
|
||||
try {
|
||||
VersionType type = VersionType.RELEASE;
|
||||
if (regex.group(1) != null) switch (regex.group(1).toLowerCase()) {
|
||||
case "pa":
|
||||
type = VersionType.PRE_ALPHA;
|
||||
break;
|
||||
case "a":
|
||||
type = VersionType.ALPHA;
|
||||
break;
|
||||
case "pb":
|
||||
type = VersionType.PRE_BETA;
|
||||
break;
|
||||
case "b":
|
||||
type = VersionType.BETA;
|
||||
break;
|
||||
case "pr":
|
||||
type = VersionType.PRE_RELEASE;
|
||||
break;
|
||||
}
|
||||
current = new Version(current, type, regex.group(2));
|
||||
} catch (Throwable e) {}
|
||||
}
|
||||
if (current == null) throw new IllegalArgumentException("Could not find version in string: " + string);
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default toString() method<br>
|
||||
* <br>
|
||||
@ -212,21 +252,82 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
* @param version The version to compare to
|
||||
*/
|
||||
public int compareTo(Version version) {
|
||||
// Compare parent versions first
|
||||
if (this.parent != null || version.parent != null) {
|
||||
int parent = ((this.parent == null)?this:this.parent).compareTo((version.parent == null)?version:version.parent);
|
||||
if (parent != 0) return parent;
|
||||
return compare(this, version);
|
||||
}
|
||||
|
||||
/**
|
||||
* See if Versions are Equal
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
* @return
|
||||
*/
|
||||
public static boolean equals(Version ver1, Version ver2) {
|
||||
return compare(ver1, ver2) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if Greater than
|
||||
* Returns 0 if Equal
|
||||
* Returns -1 if Less than
|
||||
*//**
|
||||
* Compare Versions
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
*/
|
||||
public static int compare(Version ver1, Version ver2) {
|
||||
LinkedList<Version> stack1 = new LinkedList<Version>(), stack2 = new LinkedList<Version>();
|
||||
if (ver1 != null) {
|
||||
stack1.add(ver1);
|
||||
while (ver1.parent != null) {
|
||||
ver1 = ver1.parent;
|
||||
stack1.add(ver1);
|
||||
}
|
||||
Collections.reverse(stack1);
|
||||
}
|
||||
if (ver2 != null) {
|
||||
stack2.add(ver2);
|
||||
while (ver2.parent != null) {
|
||||
ver2 = ver2.parent;
|
||||
stack2.add(ver2);
|
||||
}
|
||||
Collections.reverse(stack2);
|
||||
}
|
||||
|
||||
if (this.parent != null && version.parent == null) {
|
||||
// Version one has a parent version and version two does not, making version two the official version
|
||||
return -1;
|
||||
}
|
||||
int id;
|
||||
for (id = 0; id < stack1.size(); id++) {
|
||||
if (id >= stack2.size()) {
|
||||
// Version one still has children when version two does not, making version two the official version
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (this.parent == null && version.parent != null) {
|
||||
// Version one does not have a parent version and version two does, making version one the official version
|
||||
int result = stack1.get(id).compare(stack2.get(id));
|
||||
if (result != 0) {
|
||||
// Versions are not the same, return the result
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (id < stack2.size()) {
|
||||
// Version one does not children when version two still does, making version one the official version
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compares versions ignoring parent/child relationships
|
||||
*/
|
||||
private int compare(Version version) {
|
||||
if (this.type.stageid > version.type.stageid) {
|
||||
// Version one has a type of a later stage than version two
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (this.type.stageid < version.type.stageid) {
|
||||
// Version one has a type of an earlier stage than version two
|
||||
return -1;
|
||||
}
|
||||
|
||||
VersionTokenizer tokenizer1 = new VersionTokenizer(string);
|
||||
VersionTokenizer tokenizer2 = new VersionTokenizer(version.string);
|
||||
@ -292,29 +393,4 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* See if Versions are Equal
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
* @return
|
||||
*/
|
||||
public static boolean equals(Version ver1, Version ver2) {
|
||||
return compare(ver1, ver2) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if Greater than
|
||||
* Returns 0 if Equal
|
||||
* Returns -1 if Less than
|
||||
*//**
|
||||
* Compare Versions
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
*/
|
||||
public static int compare(Version ver1, Version ver2) {
|
||||
return ver1.compareTo(ver2);
|
||||
}
|
||||
}
|
@ -44,8 +44,8 @@ public class SubCommand {
|
||||
for (int i = 0; i < updnodeList.getLength(); i++) {
|
||||
Node node = updnodeList.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(host.version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = new Version(node.getTextContent());
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(host.version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = Version.fromString(node.getTextContent());
|
||||
updcount++;
|
||||
}
|
||||
}
|
||||
@ -53,7 +53,7 @@ public class SubCommand {
|
||||
if (updcount == 0) {
|
||||
host.log.message.println("You are on the latest version.");
|
||||
} else {
|
||||
host.log.message.println("You are " + updcount + " version" + ((updcount == 1) ? "" : "s") + " behind.");
|
||||
host.log.message.println("SubServers.Host v" + updversion + " is available. You are " + updcount + " version" + ((updcount == 1)?"":"s") + " behind.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
Binary file not shown.
@ -3,6 +3,10 @@ package net.ME1312.SubServers.Sync.Library.Version;
|
||||
import net.ME1312.SubServers.Sync.Library.Util;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Version Class
|
||||
@ -11,10 +15,10 @@ import java.io.Serializable;
|
||||
public class Version implements Serializable, Comparable<Version> {
|
||||
private final Version parent;
|
||||
private final VersionType type;
|
||||
private final String string;
|
||||
private final String string;
|
||||
|
||||
public enum VersionType {
|
||||
PRE_ALPHA(0, "pa", "pre-alpha"),
|
||||
public enum VersionType {
|
||||
PRE_ALPHA(0, "pa", "pre-alpha"),
|
||||
ALPHA(1, "a", "alpha"),
|
||||
PREVIEW(2, "pb", "preview"),
|
||||
PRE_BETA(2, "pb", "pre-beta"),
|
||||
@ -22,12 +26,12 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
PRE_RELEASE(4, "pr", "pre-release"),
|
||||
RELEASE(5, "r", "release");
|
||||
|
||||
private final int id;
|
||||
private final String shortname, longname;
|
||||
VersionType(int id, String shortname, String longname) {
|
||||
this.id = id;
|
||||
this.shortname = shortname;
|
||||
this.longname = longname;
|
||||
private final short stageid;
|
||||
private final String shortname, longname;
|
||||
VersionType(int stageid, String shortname, String longname) {
|
||||
this.stageid = (short) stageid;
|
||||
this.shortname = shortname;
|
||||
this.longname = longname;
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,9 +40,9 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
*
|
||||
* @param string Version String
|
||||
*/
|
||||
public Version(String string) {
|
||||
this(VersionType.RELEASE, string);
|
||||
}
|
||||
public Version(String string) {
|
||||
this(VersionType.RELEASE, string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Version
|
||||
@ -46,8 +50,8 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
* @param type Version Type
|
||||
* @param string Version String
|
||||
*/
|
||||
public Version(VersionType type, String string) {
|
||||
this(null, type, string);
|
||||
public Version(VersionType type, String string) {
|
||||
this(null, type, string);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,6 +129,42 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a Version from a string
|
||||
*
|
||||
* @param string String to parse
|
||||
* @see #toFullString() for a valid string value
|
||||
*/
|
||||
public static Version fromString(String string) {
|
||||
Matcher regex = Pattern.compile("(p?[abr])?([^/]+)").matcher(string);
|
||||
Version current = null;
|
||||
while (regex.find()) {
|
||||
try {
|
||||
VersionType type = VersionType.RELEASE;
|
||||
if (regex.group(1) != null) switch (regex.group(1).toLowerCase()) {
|
||||
case "pa":
|
||||
type = VersionType.PRE_ALPHA;
|
||||
break;
|
||||
case "a":
|
||||
type = VersionType.ALPHA;
|
||||
break;
|
||||
case "pb":
|
||||
type = VersionType.PRE_BETA;
|
||||
break;
|
||||
case "b":
|
||||
type = VersionType.BETA;
|
||||
break;
|
||||
case "pr":
|
||||
type = VersionType.PRE_RELEASE;
|
||||
break;
|
||||
}
|
||||
current = new Version(current, type, regex.group(2));
|
||||
} catch (Throwable e) {}
|
||||
}
|
||||
if (current == null) throw new IllegalArgumentException("Could not find version in string: " + string);
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* The default toString() method<br>
|
||||
* <br>
|
||||
@ -212,21 +252,82 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
* @param version The version to compare to
|
||||
*/
|
||||
public int compareTo(Version version) {
|
||||
// Compare parent versions first
|
||||
if (this.parent != null || version.parent != null) {
|
||||
int parent = ((this.parent == null)?this:this.parent).compareTo((version.parent == null)?version:version.parent);
|
||||
if (parent != 0) return parent;
|
||||
return compare(this, version);
|
||||
}
|
||||
|
||||
/**
|
||||
* See if Versions are Equal
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
* @return
|
||||
*/
|
||||
public static boolean equals(Version ver1, Version ver2) {
|
||||
return compare(ver1, ver2) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if Greater than
|
||||
* Returns 0 if Equal
|
||||
* Returns -1 if Less than
|
||||
*//**
|
||||
* Compare Versions
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
*/
|
||||
public static int compare(Version ver1, Version ver2) {
|
||||
LinkedList<Version> stack1 = new LinkedList<Version>(), stack2 = new LinkedList<Version>();
|
||||
if (ver1 != null) {
|
||||
stack1.add(ver1);
|
||||
while (ver1.parent != null) {
|
||||
ver1 = ver1.parent;
|
||||
stack1.add(ver1);
|
||||
}
|
||||
Collections.reverse(stack1);
|
||||
}
|
||||
if (ver2 != null) {
|
||||
stack2.add(ver2);
|
||||
while (ver2.parent != null) {
|
||||
ver2 = ver2.parent;
|
||||
stack2.add(ver2);
|
||||
}
|
||||
Collections.reverse(stack2);
|
||||
}
|
||||
|
||||
if (this.parent != null && version.parent == null) {
|
||||
// Version one has a parent version and version two does not, making version two the official version
|
||||
return -1;
|
||||
}
|
||||
int id;
|
||||
for (id = 0; id < stack1.size(); id++) {
|
||||
if (id >= stack2.size()) {
|
||||
// Version one still has children when version two does not, making version two the official version
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (this.parent == null && version.parent != null) {
|
||||
// Version one does not have a parent version and version two does, making version one the official version
|
||||
int result = stack1.get(id).compare(stack2.get(id));
|
||||
if (result != 0) {
|
||||
// Versions are not the same, return the result
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (id < stack2.size()) {
|
||||
// Version one does not children when version two still does, making version one the official version
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compares versions ignoring parent/child relationships
|
||||
*/
|
||||
private int compare(Version version) {
|
||||
if (this.type.stageid > version.type.stageid) {
|
||||
// Version one has a type of a later stage than version two
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (this.type.stageid < version.type.stageid) {
|
||||
// Version one has a type of an earlier stage than version two
|
||||
return -1;
|
||||
}
|
||||
|
||||
VersionTokenizer tokenizer1 = new VersionTokenizer(string);
|
||||
VersionTokenizer tokenizer2 = new VersionTokenizer(version.string);
|
||||
@ -292,29 +393,4 @@ public class Version implements Serializable, Comparable<Version> {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* See if Versions are Equal
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
* @return
|
||||
*/
|
||||
public static boolean equals(Version ver1, Version ver2) {
|
||||
return compare(ver1, ver2) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns 1 if Greater than
|
||||
* Returns 0 if Equal
|
||||
* Returns -1 if Less than
|
||||
*//**
|
||||
* Compare Versions
|
||||
*
|
||||
* @param ver1 Version to Compare
|
||||
* @param ver2 Version to Compare
|
||||
*/
|
||||
public static int compare(Version ver1, Version ver2) {
|
||||
return ver1.compareTo(ver2);
|
||||
}
|
||||
}
|
@ -77,8 +77,8 @@ public final class SubCommand extends CommandX {
|
||||
for (int i = 0; i < updnodeList.getLength(); i++) {
|
||||
Node node = updnodeList.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(plugin.version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = new Version(node.getTextContent());
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(plugin.version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = Version.fromString(node.getTextContent());
|
||||
updcount++;
|
||||
}
|
||||
}
|
||||
@ -86,7 +86,7 @@ public final class SubCommand extends CommandX {
|
||||
if (updcount == 0) {
|
||||
sender.sendMessage("You are on the latest version.");
|
||||
} else {
|
||||
sender.sendMessage("You are " + updcount + " version" + ((updcount == 1) ? "" : "s") + " behind.");
|
||||
sender.sendMessage("SubServers.Sync v" + updversion + " is available. You are " + updcount + " version" + ((updcount == 1)?"":"s") + " behind.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
@ -49,7 +49,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
public final SubAPI api = new SubAPI(this);
|
||||
public SubDataClient subdata = null;
|
||||
//public static final Version version = new Version("2.13a");
|
||||
public static final Version version = new Version(new Version("2.13a"), Version.VersionType.PRE_RELEASE, 1);
|
||||
//public static final Version version = new Version(new Version("2.13a"), Version.VersionType.BETA, 1); // TODO Beta Version Setting
|
||||
public static final Version version = new Version(new Version(new Version("2.13a"), Version.VersionType.PRE_RELEASE, 2), Version.VersionType.BETA, 1); // TODO Beta Version Setting
|
||||
|
||||
|
||||
public long lastReload = -1;
|
||||
@ -139,8 +140,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
for (int i = 0; i < updnodeList.getLength(); i++) {
|
||||
Node node = updnodeList.item(i);
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = new Version(node.getTextContent());
|
||||
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
|
||||
updversion = Version.fromString(node.getTextContent());
|
||||
updcount++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user