Skip to content

Commit

Permalink
added a message from the server, now ready for release
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryson Steck committed Jan 16, 2022
1 parent 23ff6e3 commit 939ef85
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/net/brysonsteck/Resurrection/Resurrection.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,20 @@ public void onEnable() {
if (check.isSuccess()) {
String newestVersion = check.getVersion();
String newestVersionURL = check.getVersionURL();
String message = check.getMessage();
if (pluginInfo.getVersion().equals(newestVersion)) {
log.info(newestVersion + " is the latest version of Resurrection.");
} else {
log.info("A new version of Resurrection is available! (current: " + pluginInfo.getVersion() + ", newest: " + newestVersion + ")");
log.info("You can download the latest release on GitHub here \\/");
log.info(newestVersionURL);
outdated = true;
}
} else {
log.info("A new version of Resurrection is available! (current: " + pluginInfo.getVersion() + ", newest: " + newestVersion + ")");
log.info("You can download the latest release on GitHub here \\/");
log.info(newestVersionURL);
outdated = true;
}
if (!message.equals("\"\"")) {
log.info("---------------------------------------------------------");
log.warning("A message from the developer has been sent from the update server: " + message);
}

}

log.info("---------------------------------------------------------");
Expand Down
6 changes: 6 additions & 0 deletions src/net/brysonsteck/Resurrection/startup/CheckForUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class CheckForUpdate {
boolean success;
String version;
String versionURL;
String message;
Logger log = JavaPlugin.getProvidingPlugin(Resurrection.class).getLogger();

public CheckForUpdate() {
Expand All @@ -30,6 +31,7 @@ public CheckForUpdate() {
version = softwareObj.get("current-release").toString();
version = version.replace("\"", "");
versionURL = softwareObj.get("github-release").toString();
message = softwareObj.get("message").toString();
success = true;
} catch (IOException e) {
log.warning("An error has occurred while attempting to check for updates.");
Expand Down Expand Up @@ -64,4 +66,8 @@ public String getVersionURL() {
public String getVersion() {
return version;
}

public String getMessage() {
return message;
}
}

0 comments on commit 939ef85

Please sign in to comment.