Add a way to parse (non-extended) layered versions

This commit is contained in:
ME1312 2018-03-15 22:45:54 -04:00
parent 12a74b3474
commit eb9bf034b4
33 changed files with 638 additions and 226 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -710,6 +710,10 @@
</dd> </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> <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>&nbsp;</dd> <dd>&nbsp;</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> </dl>
<a name="I:G"> <a name="I:G">
<!-- --> <!-- -->

View File

@ -17,7 +17,7 @@
catch(err) { 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 tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor"; var altColor = "altColor";
var rowColor = "rowColor"; var rowColor = "rowColor";
@ -249,6 +249,12 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
</td> </td>
</tr> </tr>
<tr id="i5" class="rowColor"> <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&nbsp;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="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> <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> <div class="block">The extended toString() method<br>
@ -257,7 +263,7 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<b>1.0.0 pre-alpha 7</b></div> <b>1.0.0 pre-alpha 7</b></div>
</td> </td>
</tr> </tr>
<tr id="i6" class="altColor"> <tr id="i7" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td> <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> <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> <div class="block">The full extended toString() method<br>
@ -266,7 +272,7 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<b>release 1.0.0 pre-alpha 7</b></div> <b>release 1.0.0 pre-alpha 7</b></div>
</td> </td>
</tr> </tr>
<tr id="i7" class="rowColor"> <tr id="i8" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td> <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> <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> <div class="block">The full toString() method<br>
@ -275,7 +281,7 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<b>r1.0.0/pa7</b></div> <b>r1.0.0/pa7</b></div>
</td> </td>
</tr> </tr>
<tr id="i8" class="altColor"> <tr id="i9" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td> <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> <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> <div class="block">The default toString() method<br>
@ -442,6 +448,22 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<!-- --> <!-- -->
</a> </a>
<h3>Method Detail</h3> <h3>Method Detail</h3>
<a name="fromString-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fromString</h4>
<pre>public static&nbsp;<a href="../../../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html" title="class in net.ME1312.SubServers.Bungee.Library.Version">Version</a>&nbsp;fromString(java.lang.String&nbsp;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 name="toString--">
<!-- --> <!-- -->
</a> </a>

Binary file not shown.

View File

@ -425,6 +425,10 @@
<dd> <dd>
<div class="block">Forward Packet to Client</div> <div class="block">Forward Packet to Client</div>
</dd> </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> </dl>
<a name="I:G"> <a name="I:G">
<!-- --> <!-- -->

View File

@ -17,7 +17,7 @@
catch(err) { 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 tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor"; var altColor = "altColor";
var rowColor = "rowColor"; var rowColor = "rowColor";
@ -249,6 +249,12 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
</td> </td>
</tr> </tr>
<tr id="i5" class="rowColor"> <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&nbsp;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="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> <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> <div class="block">The extended toString() method<br>
@ -257,7 +263,7 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<b>1.0.0 pre-alpha 7</b></div> <b>1.0.0 pre-alpha 7</b></div>
</td> </td>
</tr> </tr>
<tr id="i6" class="altColor"> <tr id="i7" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td> <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> <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> <div class="block">The full extended toString() method<br>
@ -266,7 +272,7 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<b>release 1.0.0 pre-alpha 7</b></div> <b>release 1.0.0 pre-alpha 7</b></div>
</td> </td>
</tr> </tr>
<tr id="i7" class="rowColor"> <tr id="i8" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td> <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> <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> <div class="block">The full toString() method<br>
@ -275,7 +281,7 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<b>r1.0.0/pa7</b></div> <b>r1.0.0/pa7</b></div>
</td> </td>
</tr> </tr>
<tr id="i8" class="altColor"> <tr id="i9" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td> <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> <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> <div class="block">The default toString() method<br>
@ -442,6 +448,22 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<!-- --> <!-- -->
</a> </a>
<h3>Method Detail</h3> <h3>Method Detail</h3>
<a name="fromString-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fromString</h4>
<pre>public static&nbsp;<a href="../../../../../../../net/ME1312/SubServers/Client/Bukkit/Library/Version/Version.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Version">Version</a>&nbsp;fromString(java.lang.String&nbsp;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 name="toString--">
<!-- --> <!-- -->
</a> </a>

Binary file not shown.

View File

@ -527,6 +527,10 @@
<dd> <dd>
<div class="block">Forward Packet to Server</div> <div class="block">Forward Packet to Server</div>
</dd> </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> </dl>
<a name="I:G"> <a name="I:G">
<!-- --> <!-- -->

View File

@ -17,7 +17,7 @@
catch(err) { 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 tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor"; var altColor = "altColor";
var rowColor = "rowColor"; var rowColor = "rowColor";
@ -249,6 +249,12 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
</td> </td>
</tr> </tr>
<tr id="i5" class="rowColor"> <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&nbsp;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="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> <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> <div class="block">The extended toString() method<br>
@ -257,7 +263,7 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<b>1.0.0 pre-alpha 7</b></div> <b>1.0.0 pre-alpha 7</b></div>
</td> </td>
</tr> </tr>
<tr id="i6" class="altColor"> <tr id="i7" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td> <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> <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> <div class="block">The full extended toString() method<br>
@ -266,7 +272,7 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<b>release 1.0.0 pre-alpha 7</b></div> <b>release 1.0.0 pre-alpha 7</b></div>
</td> </td>
</tr> </tr>
<tr id="i7" class="rowColor"> <tr id="i8" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td> <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> <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> <div class="block">The full toString() method<br>
@ -275,7 +281,7 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<b>r1.0.0/pa7</b></div> <b>r1.0.0/pa7</b></div>
</td> </td>
</tr> </tr>
<tr id="i8" class="altColor"> <tr id="i9" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td> <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> <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> <div class="block">The default toString() method<br>
@ -442,6 +448,22 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<!-- --> <!-- -->
</a> </a>
<h3>Method Detail</h3> <h3>Method Detail</h3>
<a name="fromString-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fromString</h4>
<pre>public static&nbsp;<a href="../../../../../../net/ME1312/SubServers/Host/Library/Version/Version.html" title="class in net.ME1312.SubServers.Host.Library.Version">Version</a>&nbsp;fromString(java.lang.String&nbsp;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 name="toString--">
<!-- --> <!-- -->
</a> </a>

Binary file not shown.

View File

@ -423,6 +423,10 @@
<dd> <dd>
<div class="block">Forward Packet to Client</div> <div class="block">Forward Packet to Client</div>
</dd> </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> </dl>
<a name="I:G"> <a name="I:G">
<!-- --> <!-- -->

View File

@ -17,7 +17,7 @@
catch(err) { 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 tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor"; var altColor = "altColor";
var rowColor = "rowColor"; var rowColor = "rowColor";
@ -249,6 +249,12 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
</td> </td>
</tr> </tr>
<tr id="i5" class="rowColor"> <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&nbsp;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="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> <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> <div class="block">The extended toString() method<br>
@ -257,7 +263,7 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<b>1.0.0 pre-alpha 7</b></div> <b>1.0.0 pre-alpha 7</b></div>
</td> </td>
</tr> </tr>
<tr id="i6" class="altColor"> <tr id="i7" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td> <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> <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> <div class="block">The full extended toString() method<br>
@ -266,7 +272,7 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<b>release 1.0.0 pre-alpha 7</b></div> <b>release 1.0.0 pre-alpha 7</b></div>
</td> </td>
</tr> </tr>
<tr id="i7" class="rowColor"> <tr id="i8" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td> <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> <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> <div class="block">The full toString() method<br>
@ -275,7 +281,7 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<b>r1.0.0/pa7</b></div> <b>r1.0.0/pa7</b></div>
</td> </td>
</tr> </tr>
<tr id="i8" class="altColor"> <tr id="i9" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td> <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> <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> <div class="block">The default toString() method<br>
@ -442,6 +448,22 @@ implements java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../..
<!-- --> <!-- -->
</a> </a>
<h3>Method Detail</h3> <h3>Method Detail</h3>
<a name="fromString-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fromString</h4>
<pre>public static&nbsp;<a href="../../../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html" title="class in net.ME1312.SubServers.Sync.Library.Version">Version</a>&nbsp;fromString(java.lang.String&nbsp;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 name="toString--">
<!-- --> <!-- -->
</a> </a>

Binary file not shown.

View File

@ -31,7 +31,7 @@ Lang:
'Command.Help.SubServer.Terminate': ' &7Terminate Server:&f $str$' 'Command.Help.SubServer.Terminate': ' &7Terminate Server:&f $str$'
'Command.Help.SubServer.Command': ' &7Command 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': '&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.Version.Latest': '&7You are on the latest version.'
'Command.List.Group-Header': '&7SubServers &8&l\u00BB&7 Group/Server List:' 'Command.List.Group-Header': '&7SubServers &8&l\u00BB&7 Group/Server List:'
'Command.List.Host-Header': '&7SubServers &8&l\u00BB&7 Host/SubServer List:' 'Command.List.Host-Header': '&7SubServers &8&l\u00BB&7 Host/SubServer List:'

View File

@ -3,6 +3,10 @@ package net.ME1312.SubServers.Bungee.Library.Version;
import net.ME1312.SubServers.Bungee.Library.Util; import net.ME1312.SubServers.Bungee.Library.Util;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collections;
import java.util.LinkedList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* Version Class * Version Class
@ -22,10 +26,10 @@ public class Version implements Serializable, Comparable<Version> {
PRE_RELEASE(4, "pr", "pre-release"), PRE_RELEASE(4, "pr", "pre-release"),
RELEASE(5, "r", "release"); RELEASE(5, "r", "release");
private final int id; private final short stageid;
private final String shortname, longname; private final String shortname, longname;
VersionType(int id, String shortname, String longname) { VersionType(int stageid, String shortname, String longname) {
this.id = id; this.stageid = (short) stageid;
this.shortname = shortname; this.shortname = shortname;
this.longname = longname; this.longname = longname;
} }
@ -125,6 +129,42 @@ public class Version implements Serializable, Comparable<Version> {
this.string = string; 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> * The default toString() method<br>
* <br> * <br>
@ -212,21 +252,82 @@ public class Version implements Serializable, Comparable<Version> {
* @param version The version to compare to * @param version The version to compare to
*/ */
public int compareTo(Version version) { public int compareTo(Version version) {
// Compare parent versions first return compare(this, version);
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;
} }
if (this.parent != null && version.parent == null) { /**
// Version one has a parent version and version two does not, making version two the official 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);
}
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; return -1;
} }
if (this.parent == null && version.parent != null) { int result = stack1.get(id).compare(stack2.get(id));
// Version one does not have a parent version and version two does, making version one the official version 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 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 tokenizer1 = new VersionTokenizer(string);
VersionTokenizer tokenizer2 = new VersionTokenizer(version.string); VersionTokenizer tokenizer2 = new VersionTokenizer(version.string);
@ -292,29 +393,4 @@ public class Version implements Serializable, Comparable<Version> {
} }
return 0; 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);
}
} }

View File

@ -77,8 +77,8 @@ public final class SubCommand extends CommandX {
for (int i = 0; i < updnodeList.getLength(); i++) { for (int i = 0; i < updnodeList.getLength(); i++) {
Node node = updnodeList.item(i); Node node = updnodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getNodeType() == Node.ELEMENT_NODE) {
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(plugin.version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) { if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(plugin.version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
updversion = new Version(node.getTextContent()); updversion = Version.fromString(node.getTextContent());
updcount++; updcount++;
} }
} }
@ -86,7 +86,7 @@ public final class SubCommand extends CommandX {
if (updcount == 0) { if (updcount == 0) {
sender.sendMessage("You are on the latest version."); sender.sendMessage("You are on the latest version.");
} else { } 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) {} } catch (Exception e) {}
}).start(); }).start();

View File

@ -58,7 +58,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
public SubDataServer subdata = null; public SubDataServer subdata = null;
public SubServer sudo = null; public SubServer sudo = null;
//public static final Version version = new Version("2.13a"); //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 boolean redis = false;
public long resetDate = 0; public long resetDate = 0;
@ -502,8 +503,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
for (int i = 0; i < updnodeList.getLength(); i++) { for (int i = 0; i < updnodeList.getLength(); i++) {
Node node = updnodeList.item(i); Node node = updnodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getNodeType() == Node.ELEMENT_NODE) {
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) { if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
updversion = new Version(node.getTextContent()); updversion = Version.fromString(node.getTextContent());
updcount++; updcount++;
} }
} }

Binary file not shown.

View File

@ -3,6 +3,10 @@ package net.ME1312.SubServers.Client.Bukkit.Library.Version;
import net.ME1312.SubServers.Client.Bukkit.Library.Util; import net.ME1312.SubServers.Client.Bukkit.Library.Util;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collections;
import java.util.LinkedList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* Version Class * Version Class
@ -22,10 +26,10 @@ public class Version implements Serializable, Comparable<Version> {
PRE_RELEASE(4, "pr", "pre-release"), PRE_RELEASE(4, "pr", "pre-release"),
RELEASE(5, "r", "release"); RELEASE(5, "r", "release");
private final int id; private final short stageid;
private final String shortname, longname; private final String shortname, longname;
VersionType(int id, String shortname, String longname) { VersionType(int stageid, String shortname, String longname) {
this.id = id; this.stageid = (short) stageid;
this.shortname = shortname; this.shortname = shortname;
this.longname = longname; this.longname = longname;
} }
@ -125,6 +129,42 @@ public class Version implements Serializable, Comparable<Version> {
this.string = string; 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> * The default toString() method<br>
* <br> * <br>
@ -212,21 +252,82 @@ public class Version implements Serializable, Comparable<Version> {
* @param version The version to compare to * @param version The version to compare to
*/ */
public int compareTo(Version version) { public int compareTo(Version version) {
// Compare parent versions first return compare(this, version);
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;
} }
if (this.parent != null && version.parent == null) { /**
// Version one has a parent version and version two does not, making version two the official 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);
}
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; return -1;
} }
if (this.parent == null && version.parent != null) { int result = stack1.get(id).compare(stack2.get(id));
// Version one does not have a parent version and version two does, making version one the official version 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 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 tokenizer1 = new VersionTokenizer(string);
VersionTokenizer tokenizer2 = new VersionTokenizer(version.string); VersionTokenizer tokenizer2 = new VersionTokenizer(version.string);
@ -292,29 +393,4 @@ public class Version implements Serializable, Comparable<Version> {
} }
return 0; 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);
}
} }

View File

@ -59,8 +59,8 @@ public final class SubCommand implements CommandExecutor {
for (int i = 0; i < updnodeList.getLength(); i++) { for (int i = 0; i < updnodeList.getLength(); i++) {
Node node = updnodeList.item(i); Node node = updnodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getNodeType() == Node.ELEMENT_NODE) {
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(plugin.version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) { if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(plugin.version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
updversion = new Version(node.getTextContent()); updversion = Version.fromString(node.getTextContent());
updcount++; updcount++;
} }
} }
@ -68,7 +68,7 @@ public final class SubCommand implements CommandExecutor {
if (updcount == 0) { if (updcount == 0) {
sender.sendMessage(plugin.api.getLang("SubServers", "Command.Version.Latest")); sender.sendMessage(plugin.api.getLang("SubServers", "Command.Version.Latest"));
} else { } 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) {} } catch (Exception e) {}
}); });

View File

@ -45,7 +45,8 @@ public final class SubPlugin extends JavaPlugin {
public SubPlugin() { public SubPlugin() {
super(); super();
//version = new Version(getDescription().getVersion()); //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++) { for (int i = 0; i < updnodeList.getLength(); i++) {
Node node = updnodeList.item(i); Node node = updnodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getNodeType() == Node.ELEMENT_NODE) {
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) { if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
updversion = new Version(node.getTextContent()); updversion = Version.fromString(node.getTextContent());
updcount++; updcount++;
} }
} }

Binary file not shown.

View File

@ -58,7 +58,8 @@ public final class ExHost {
public SubDataClient subdata = null; public SubDataClient subdata = null;
//public final Version version = new Version("2.13a"); //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); public final SubAPI api = new SubAPI(this);
private ConsoleReader jline; private ConsoleReader jline;
@ -391,8 +392,8 @@ public final class ExHost {
for (int i = 0; i < updnodeList.getLength(); i++) { for (int i = 0; i < updnodeList.getLength(); i++) {
Node node = updnodeList.item(i); Node node = updnodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getNodeType() == Node.ELEMENT_NODE) {
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) { if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
updversion = new Version(node.getTextContent()); updversion = Version.fromString(node.getTextContent());
updcount++; updcount++;
} }
} }

View File

@ -3,6 +3,10 @@ package net.ME1312.SubServers.Host.Library.Version;
import net.ME1312.SubServers.Host.Library.Util; import net.ME1312.SubServers.Host.Library.Util;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collections;
import java.util.LinkedList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* Version Class * Version Class
@ -22,10 +26,10 @@ public class Version implements Serializable, Comparable<Version> {
PRE_RELEASE(4, "pr", "pre-release"), PRE_RELEASE(4, "pr", "pre-release"),
RELEASE(5, "r", "release"); RELEASE(5, "r", "release");
private final int id; private final short stageid;
private final String shortname, longname; private final String shortname, longname;
VersionType(int id, String shortname, String longname) { VersionType(int stageid, String shortname, String longname) {
this.id = id; this.stageid = (short) stageid;
this.shortname = shortname; this.shortname = shortname;
this.longname = longname; this.longname = longname;
} }
@ -125,6 +129,42 @@ public class Version implements Serializable, Comparable<Version> {
this.string = string; 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> * The default toString() method<br>
* <br> * <br>
@ -212,21 +252,82 @@ public class Version implements Serializable, Comparable<Version> {
* @param version The version to compare to * @param version The version to compare to
*/ */
public int compareTo(Version version) { public int compareTo(Version version) {
// Compare parent versions first return compare(this, version);
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;
} }
if (this.parent != null && version.parent == null) { /**
// Version one has a parent version and version two does not, making version two the official 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);
}
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; return -1;
} }
if (this.parent == null && version.parent != null) { int result = stack1.get(id).compare(stack2.get(id));
// Version one does not have a parent version and version two does, making version one the official version 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 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 tokenizer1 = new VersionTokenizer(string);
VersionTokenizer tokenizer2 = new VersionTokenizer(version.string); VersionTokenizer tokenizer2 = new VersionTokenizer(version.string);
@ -292,29 +393,4 @@ public class Version implements Serializable, Comparable<Version> {
} }
return 0; 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);
}
} }

View File

@ -44,8 +44,8 @@ public class SubCommand {
for (int i = 0; i < updnodeList.getLength(); i++) { for (int i = 0; i < updnodeList.getLength(); i++) {
Node node = updnodeList.item(i); Node node = updnodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getNodeType() == Node.ELEMENT_NODE) {
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(host.version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) { if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(host.version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
updversion = new Version(node.getTextContent()); updversion = Version.fromString(node.getTextContent());
updcount++; updcount++;
} }
} }
@ -53,7 +53,7 @@ public class SubCommand {
if (updcount == 0) { if (updcount == 0) {
host.log.message.println("You are on the latest version."); host.log.message.println("You are on the latest version.");
} else { } 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) { } catch (Exception e) {
} }

Binary file not shown.

View File

@ -3,6 +3,10 @@ package net.ME1312.SubServers.Sync.Library.Version;
import net.ME1312.SubServers.Sync.Library.Util; import net.ME1312.SubServers.Sync.Library.Util;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collections;
import java.util.LinkedList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* Version Class * Version Class
@ -22,10 +26,10 @@ public class Version implements Serializable, Comparable<Version> {
PRE_RELEASE(4, "pr", "pre-release"), PRE_RELEASE(4, "pr", "pre-release"),
RELEASE(5, "r", "release"); RELEASE(5, "r", "release");
private final int id; private final short stageid;
private final String shortname, longname; private final String shortname, longname;
VersionType(int id, String shortname, String longname) { VersionType(int stageid, String shortname, String longname) {
this.id = id; this.stageid = (short) stageid;
this.shortname = shortname; this.shortname = shortname;
this.longname = longname; this.longname = longname;
} }
@ -125,6 +129,42 @@ public class Version implements Serializable, Comparable<Version> {
this.string = string; 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> * The default toString() method<br>
* <br> * <br>
@ -212,21 +252,82 @@ public class Version implements Serializable, Comparable<Version> {
* @param version The version to compare to * @param version The version to compare to
*/ */
public int compareTo(Version version) { public int compareTo(Version version) {
// Compare parent versions first return compare(this, version);
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;
} }
if (this.parent != null && version.parent == null) { /**
// Version one has a parent version and version two does not, making version two the official 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);
}
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; return -1;
} }
if (this.parent == null && version.parent != null) { int result = stack1.get(id).compare(stack2.get(id));
// Version one does not have a parent version and version two does, making version one the official version 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 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 tokenizer1 = new VersionTokenizer(string);
VersionTokenizer tokenizer2 = new VersionTokenizer(version.string); VersionTokenizer tokenizer2 = new VersionTokenizer(version.string);
@ -292,29 +393,4 @@ public class Version implements Serializable, Comparable<Version> {
} }
return 0; 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);
}
} }

View File

@ -77,8 +77,8 @@ public final class SubCommand extends CommandX {
for (int i = 0; i < updnodeList.getLength(); i++) { for (int i = 0; i < updnodeList.getLength(); i++) {
Node node = updnodeList.item(i); Node node = updnodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getNodeType() == Node.ELEMENT_NODE) {
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(plugin.version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) { if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(plugin.version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
updversion = new Version(node.getTextContent()); updversion = Version.fromString(node.getTextContent());
updcount++; updcount++;
} }
} }
@ -86,7 +86,7 @@ public final class SubCommand extends CommandX {
if (updcount == 0) { if (updcount == 0) {
sender.sendMessage("You are on the latest version."); sender.sendMessage("You are on the latest version.");
} else { } 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) { } catch (Exception e) {
} }

View File

@ -49,7 +49,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
public final SubAPI api = new SubAPI(this); public final SubAPI api = new SubAPI(this);
public SubDataClient subdata = null; public SubDataClient subdata = null;
//public static final Version version = new Version("2.13a"); //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; public long lastReload = -1;
@ -139,8 +140,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
for (int i = 0; i < updnodeList.getLength(); i++) { for (int i = 0; i < updnodeList.getLength(); i++) {
Node node = updnodeList.item(i); Node node = updnodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getNodeType() == Node.ELEMENT_NODE) {
if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && new Version(node.getTextContent()).compareTo(updversion) > 0) { if (!node.getTextContent().startsWith("-") && !node.getTextContent().equals(version.toString()) && Version.fromString(node.getTextContent()).compareTo(updversion) > 0) {
updversion = new Version(node.getTextContent()); updversion = Version.fromString(node.getTextContent());
updcount++; updcount++;
} }
} }