feat: (Re-) Add update notifications (#1361)

* feat: (Re-) Add update notifications

Fixes #1348

* Move update notification to seperate class

- Add a couple of linebreaks to the chat messages
This commit is contained in:
NotMyFault
2021-10-17 09:55:25 +02:00
committed by GitHub
parent e5fbc4c971
commit 5db9a601b1
6 changed files with 103 additions and 3 deletions

View File

@ -2,6 +2,8 @@ package com.fastasyncworldedit.core;
/**
* An internal FAWE class not meant for public use.
*
* @hidden
**/
public class FaweVersion {
@ -46,12 +48,19 @@ public class FaweVersion {
@Override
public String toString() {
if (hash == 0 && build == 0) {
return "FastAsyncWorldEdit-1.17-NoVer-SNAPSHOT";
return getSimpleVersionName() + "-NoVer-SNAPSHOT";
} else {
return "FastAsyncWorldEdit-1.17" + build;
return getSimpleVersionName() + "-" + build;
}
}
/**
* @return The qualified version name
*/
public String getSimpleVersionName() {
return "FastAsyncWorldEdit-1.17";
}
public boolean isNewer(FaweVersion other) {
return other.build < this.build;
}

View File

@ -92,6 +92,8 @@ public class Settings extends Config {
@Comment({"Show additional information in console. It helps us at IntellectualSites to find out more about an issue.",
"Leave it off if you don't need it, it can spam your console."})
public boolean DEBUG = false;
@Comment({"Whether or not FAWE should notify you on startup about new versions available."})
public boolean UPDATE_NOTIFICATIONS = true;
}

View File

@ -15,7 +15,8 @@
"fawe.info.worldedit.bypassed": "Currently bypassing FAWE restriction.",
"fawe.info.worldedit.restricted": "Your FAWE edits are now restricted.",
"fawe.info.worldedit.oom.admin": "Possible options:\n - //fast\n - Do smaller edits\n - Allocate more memory\n - Disable `max-memory-percent`",
"fawe.info.temporarily-not-working": "Temporarily not working",
"fawe.info.temporarily-not-working": "Temporarily not working",
"fawe.info.update-available": "An update for FastAsyncWorldEdit is available. You are {0} build(s) out of date.\nYou are running version {1}, the latest version is {2}.\nUpdate at {3}",
"fawe.web.generating.link": "Uploading {0}, please wait...",
"fawe.web.generating.link.failed": "Failed to generate download link!",