Skip to content

Commit

Permalink
fix: VersionChecker logger accessing non-existent @shadow
Browse files Browse the repository at this point in the history
  • Loading branch information
RedVortexDev committed Jan 7, 2025
1 parent e1c5a57 commit 8948c18
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/main/java/dev/dfonline/codeclient/mixin/VersionChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
import dev.dfonline.codeclient.CodeClient;
import dev.dfonline.codeclient.config.Config;
import org.slf4j.Logger;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand All @@ -21,9 +20,8 @@

@Mixin(UpdateCheckerUtil.class)
public class VersionChecker {
@Shadow
@Final
public static Logger LOGGER;
@Unique
private static final Logger LOGGER = UpdateCheckerUtil.LOGGER;

@Inject(method = "checkForUpdates0", at = @At("TAIL"), remap = false)
private static void checkVersion(CallbackInfo ci) {
Expand All @@ -45,15 +43,15 @@ private static void checkVersion(CallbackInfo ci) {
// Get the new version.
final String versionUrl = "https://api.modrinth.com/v2/version/" + modrinthUpdateInfo.getVersionId();

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(versionUrl))
.build();
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(CodeClient::parseVersionInfo)
.join();

try (HttpClient client = HttpClient.newHttpClient()) {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(versionUrl))
.build();
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(CodeClient::parseVersionInfo)
.join();
}
}
}
}

1 comment on commit 8948c18

@RedVortexDev
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accidental @-mention 🗣

Please sign in to comment.