updater should work now
This commit is contained in:
parent
1dade4db82
commit
65033eee49
5 changed files with 22 additions and 10 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -47,7 +47,6 @@ public class Resurrection extends JavaPlugin {
|
|||
|
||||
// end of spigot things
|
||||
public static void main(String[] args) {
|
||||
|
||||
// PlayerData playerData = new PlayerData();
|
||||
// playerData.saveData("This is the first line\nthis is the second line");
|
||||
// System.out.println(playerData.getPlayers());
|
||||
|
|
|
@ -3,11 +3,9 @@ package net.brysonsteck.Resurrection.startup;
|
|||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
@ -19,11 +17,8 @@ public class CheckForUpdate {
|
|||
|
||||
public CheckForUpdate() {
|
||||
try {
|
||||
URL url = new URL("http://resurrect.brysonsteck.net");
|
||||
URLConnection request = url.openConnection();
|
||||
request.connect();
|
||||
JsonParser json = new JsonParser();
|
||||
JsonElement root = json.parse(new InputStreamReader((InputStream) request.getContent()));
|
||||
String json = urlReader();
|
||||
JsonElement root = new JsonParser().parse(json);
|
||||
JsonObject rootobj = root.getAsJsonObject();
|
||||
version = rootobj.get("current-version").getAsString();
|
||||
versionURL = rootobj.get("release-url").getAsString();
|
||||
|
@ -33,6 +28,24 @@ public class CheckForUpdate {
|
|||
}
|
||||
}
|
||||
|
||||
public String urlReader() throws IOException {
|
||||
URL website = new URL("https://brysonsteck.net/resurrect.json");
|
||||
URLConnection connection = website.openConnection();
|
||||
BufferedReader in = new BufferedReader(
|
||||
new InputStreamReader(
|
||||
connection.getInputStream()));
|
||||
|
||||
StringBuilder response = new StringBuilder();
|
||||
String inputLine;
|
||||
|
||||
while ((inputLine = in.readLine()) != null)
|
||||
response.append(inputLine);
|
||||
|
||||
in.close();
|
||||
|
||||
return response.toString();
|
||||
}
|
||||
|
||||
public String getVersionURL() {
|
||||
return versionURL;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue