From 2c876287a167b17b954b3e25c7bb6fedb86893c6 Mon Sep 17 00:00:00 2001 From: MemencioPerez Date: Wed, 1 Jan 2025 21:53:54 -0400 Subject: [PATCH] misc: Get an instance of the UpdateChecker class using the Guice injector --- .../io/github/_4drian3d/unsignedvelocity/UnSignedVelocity.java | 3 +-- .../unsignedvelocity/updatechecker/UpdateChecker.java | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/_4drian3d/unsignedvelocity/UnSignedVelocity.java b/src/main/java/io/github/_4drian3d/unsignedvelocity/UnSignedVelocity.java index 1402fbb..c5bdb29 100644 --- a/src/main/java/io/github/_4drian3d/unsignedvelocity/UnSignedVelocity.java +++ b/src/main/java/io/github/_4drian3d/unsignedvelocity/UnSignedVelocity.java @@ -167,8 +167,7 @@ public List getPluginStatusMessages() { } private void checkForUpdates() { - UpdateChecker updateChecker = new UpdateChecker(logger); - updateChecker.checkForUpdates(); + injector.getInstance(UpdateChecker.class).checkForUpdates(); } public boolean isFirstLoad() { diff --git a/src/main/java/io/github/_4drian3d/unsignedvelocity/updatechecker/UpdateChecker.java b/src/main/java/io/github/_4drian3d/unsignedvelocity/updatechecker/UpdateChecker.java index b45af7c..13ff0e7 100644 --- a/src/main/java/io/github/_4drian3d/unsignedvelocity/updatechecker/UpdateChecker.java +++ b/src/main/java/io/github/_4drian3d/unsignedvelocity/updatechecker/UpdateChecker.java @@ -2,6 +2,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import com.google.inject.Inject; import io.github._4drian3d.unsignedvelocity.utils.Constants; import net.kyori.adventure.text.logger.slf4j.ComponentLogger; @@ -14,6 +15,7 @@ public class UpdateChecker { private final ComponentLogger logger; + @Inject public UpdateChecker(ComponentLogger logger) { this.logger = logger; }