Skip to content

Commit

Permalink
Add config option to disable updates checker
Browse files Browse the repository at this point in the history
Fixes #44
  • Loading branch information
UserNugget committed Oct 18, 2024
1 parent 1bb011d commit 688f388
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/main/java/net/elytrium/velocitytools/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class Settings extends YamlSerializable {

public static class MAIN {

@Comment(@CommentValue("Should this plugin check for new updates?"))
public boolean CHECK_FOR_UPDATES = true;

@Comment({
@CommentValue("VelocityTools will consume more RAM if this option is enabled, but compatibility with other plugins will be better"),
@CommentValue("Enable it if you have a plugin installed that bypasses compression (e.g. Geyser)")
Expand Down
14 changes: 9 additions & 5 deletions src/main/java/net/elytrium/velocitytools/VelocityTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,15 @@ public void onProxyInitialization(ProxyInitializeEvent event) {

HooksInitializer.init(this.server);

if (!UpdatesChecker.checkVersionByURL("https://raw.githubusercontent.com/Elytrium/VelocityTools/master/VERSION", Settings.IMP.VERSION)) {
LOGGER.error("****************************************");
LOGGER.warn("The new VelocityTools update was found, please update.");
LOGGER.error("https://github.com/Elytrium/VelocityTools/releases/");
LOGGER.error("****************************************");
if (Settings.IMP.MAIN.CHECK_FOR_UPDATES) {
this.server.getScheduler().buildTask(this, () -> {
if (!UpdatesChecker.checkVersionByURL("https://raw.githubusercontent.com/Elytrium/VelocityTools/master/VERSION", Settings.IMP.VERSION)) {
LOGGER.error("****************************************");
LOGGER.warn("The new VelocityTools update was found, please update.");
LOGGER.error("https://github.com/Elytrium/VelocityTools/releases/");
LOGGER.error("****************************************");
}
}).schedule();
}
this.metricsFactory.make(this, 12708);
}
Expand Down

0 comments on commit 688f388

Please sign in to comment.