Ready for release.
This commit is contained in:
1 parent
f9cab45f1b
commit
fc778193c0
1 file changed
+34
-15
@@ -1,7 +1,11 @@
|
|||||||
package com.rsscripting.mobstand.utils;
|
package com.rsscripting.mobstand.utils;
|
||||||
|
|
||||||
import com.rsscripting.mobstand.RSMobStandPlugin;
|
import com.rsscripting.mobstand.RSMobStandPlugin;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@@ -14,7 +18,7 @@ public class VersionChecker {
|
|||||||
"Unknown";
|
"Unknown";
|
||||||
|
|
||||||
private static final String VERSION_URL =
|
private static final String VERSION_URL =
|
||||||
"https://raw.githubusercontent.com/RS-Scripting/RS-MobStand/main/version.txt";
|
"https://raw.githubusercontent.com/RS-Scripting/RS-MobStand/main/pom.xml";
|
||||||
|
|
||||||
public VersionChecker(
|
public VersionChecker(
|
||||||
RSMobStandPlugin plugin
|
RSMobStandPlugin plugin
|
||||||
@@ -36,28 +40,43 @@ public class VersionChecker {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| READ VERSION FILE
|
| READ VERSION FROM POM
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
URL url =
|
URL url =
|
||||||
new URL(
|
new URL(
|
||||||
VERSION_URL
|
VERSION_URL
|
||||||
);
|
);
|
||||||
|
|
||||||
BufferedReader reader =
|
DocumentBuilderFactory factory =
|
||||||
new BufferedReader(
|
DocumentBuilderFactory.newInstance();
|
||||||
new InputStreamReader(
|
|
||||||
url.openStream()
|
DocumentBuilder builder =
|
||||||
)
|
factory.newDocumentBuilder();
|
||||||
|
|
||||||
|
Document document =
|
||||||
|
builder.parse(
|
||||||
|
url.openStream()
|
||||||
);
|
);
|
||||||
|
|
||||||
latestVersion =
|
document.getDocumentElement()
|
||||||
reader.readLine();
|
.normalize();
|
||||||
|
|
||||||
reader.close();
|
NodeList versionNodes =
|
||||||
|
document.getElementsByTagName(
|
||||||
|
"version"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (versionNodes.getLength() > 0) {
|
||||||
|
|
||||||
|
latestVersion =
|
||||||
|
versionNodes.item(0)
|
||||||
|
.getTextContent()
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in new issue
Block a user