mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-06 15:44:49 +08:00
[New] Implemented update check setting
Setting: Plugin.Check-for-updates Affected issues: #751
This commit is contained in:
parent
0b7198df07
commit
6a8f93be89
@ -31,6 +31,7 @@ public enum Settings implements Setting {
|
|||||||
DISPLAY_GAPS_IN_GRAPH_DATA("Customization.Display.GapsInGraphData"),
|
DISPLAY_GAPS_IN_GRAPH_DATA("Customization.Display.GapsInGraphData"),
|
||||||
DATA_GEOLOCATIONS("Data.Geolocations"),
|
DATA_GEOLOCATIONS("Data.Geolocations"),
|
||||||
NOTIFY_ABOUT_DEV_RELEASES("Plugin.Notify-About-DEV-Releases"),
|
NOTIFY_ABOUT_DEV_RELEASES("Plugin.Notify-About-DEV-Releases"),
|
||||||
|
CHECK_FOR_UPDATES("Plugin.Check-for-updates"),
|
||||||
|
|
||||||
// Integer
|
// Integer
|
||||||
WEBSERVER_PORT("WebServer.Port"),
|
WEBSERVER_PORT("WebServer.Port"),
|
||||||
|
@ -18,6 +18,7 @@ import javax.inject.Named;
|
|||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,6 +55,9 @@ public class VersionCheckSystem implements SubSystem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
|
if (config.isFalse(Settings.CHECK_FOR_UPDATES)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
List<VersionInfo> versions = VersionInfoLoader.load();
|
List<VersionInfo> versions = VersionInfoLoader.load();
|
||||||
if (config.isFalse(Settings.NOTIFY_ABOUT_DEV_RELEASES)) {
|
if (config.isFalse(Settings.NOTIFY_ABOUT_DEV_RELEASES)) {
|
||||||
@ -83,7 +87,7 @@ public class VersionCheckSystem implements SubSystem {
|
|||||||
/* Does not need to be closed */
|
/* Does not need to be closed */
|
||||||
}
|
}
|
||||||
|
|
||||||
public VersionInfo getNewVersionAvailable() {
|
public Optional<VersionInfo> getNewVersionAvailable() {
|
||||||
return newVersionAvailable;
|
return Optional.ofNullable(newVersionAvailable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ Network:
|
|||||||
Plugin:
|
Plugin:
|
||||||
Debug: 'false'
|
Debug: 'false'
|
||||||
Locale: default
|
Locale: default
|
||||||
|
Check-for-updates: true
|
||||||
Notify-About-DEV-Releases: false
|
Notify-About-DEV-Releases: false
|
||||||
KeepLogsForXDays: 7
|
KeepLogsForXDays: 7
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ Plugin:
|
|||||||
Bungee-Override:
|
Bungee-Override:
|
||||||
StandaloneMode: false
|
StandaloneMode: false
|
||||||
CopyBungeeConfig: true
|
CopyBungeeConfig: true
|
||||||
|
Check-for-updates: true
|
||||||
Notify-About-DEV-Releases: false
|
Notify-About-DEV-Releases: false
|
||||||
KeepLogsForXDays: 7
|
KeepLogsForXDays: 7
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user