Skip to content

Commit 688f388

Browse files
committed
Add config option to disable updates checker
Fixes #44
1 parent 1bb011d commit 688f388

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/main/java/net/elytrium/velocitytools/Settings.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public class Settings extends YamlSerializable {
4747

4848
public static class MAIN {
4949

50+
@Comment(@CommentValue("Should this plugin check for new updates?"))
51+
public boolean CHECK_FOR_UPDATES = true;
52+
5053
@Comment({
5154
@CommentValue("VelocityTools will consume more RAM if this option is enabled, but compatibility with other plugins will be better"),
5255
@CommentValue("Enable it if you have a plugin installed that bypasses compression (e.g. Geyser)")

src/main/java/net/elytrium/velocitytools/VelocityTools.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,15 @@ public void onProxyInitialization(ProxyInitializeEvent event) {
120120

121121
HooksInitializer.init(this.server);
122122

123-
if (!UpdatesChecker.checkVersionByURL("https://raw.githubusercontent.com/Elytrium/VelocityTools/master/VERSION", Settings.IMP.VERSION)) {
124-
LOGGER.error("****************************************");
125-
LOGGER.warn("The new VelocityTools update was found, please update.");
126-
LOGGER.error("https://github.com/Elytrium/VelocityTools/releases/");
127-
LOGGER.error("****************************************");
123+
if (Settings.IMP.MAIN.CHECK_FOR_UPDATES) {
124+
this.server.getScheduler().buildTask(this, () -> {
125+
if (!UpdatesChecker.checkVersionByURL("https://raw.githubusercontent.com/Elytrium/VelocityTools/master/VERSION", Settings.IMP.VERSION)) {
126+
LOGGER.error("****************************************");
127+
LOGGER.warn("The new VelocityTools update was found, please update.");
128+
LOGGER.error("https://github.com/Elytrium/VelocityTools/releases/");
129+
LOGGER.error("****************************************");
130+
}
131+
}).schedule();
128132
}
129133
this.metricsFactory.make(this, 12708);
130134
}

0 commit comments

Comments
 (0)