Skip to content

Commit

Permalink
fix: DataFetcher does not respect chosen Data URL
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Sep 28, 2024
1 parent 461c11b commit 24d1c76
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
13 changes: 11 additions & 2 deletions src/main/java/gg/skytils/skytilsmod/tweaker/SkytilsTweaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
import java.util.List;

import static gg.skytils.skytilsmod.tweaker.SkytilsSecurityManager.overrideSecurityManager;
import static gg.skytils.skytilsmod.tweaker.TweakerUtil.registerTransformerExclusions;
import static gg.skytils.skytilsmod.tweaker.TweakerUtil.runStage;

@SuppressWarnings("unused")
public class SkytilsTweaker extends EssentialSetupTweaker {

public SkytilsTweaker() throws Throwable {
runStage("gg.skytils.skytilsmod.tweaker.DuplicateSkytilsChecker", "checkForDuplicates");
DuplicateSkytilsChecker.checkForDuplicates();
runStage("gg.skytils.skytilsmod.utils.SuperSecretSettings", "load");
boolean isFML = System.getSecurityManager() != null && System.getSecurityManager().getClass().equals(FMLSecurityManager.class);
if (System.getProperty("skytils.noSecurityManager") == null && (System.getSecurityManager() == null || isFML || System.getSecurityManager().getClass() == SecurityManager.class)) {
Expand All @@ -43,7 +44,15 @@ public SkytilsTweaker() throws Throwable {
runStage("gg.skytils.skytilsmod.tweaker.SkytilsSecurityManager", "overrideSecurityManager", isFML);
System.out.println("Current security manager: " + System.getSecurityManager());
}
runStage("gg.skytils.skytilsmod.tweaker.EssentialPlatformSetup", "setup");
registerTransformerExclusions(
"kotlin.",
"kotlinx.",
"gg.skytils.asmhelper.",
"gg.skytils.skytilsmod.tweaker.",
"gg.skytils.skytilsmod.asm."
);
DependencyLoader.loadDependencies();
runStage("gg.skytils.skytilsmod.utils.EssentialPlatformSetup", "setup");
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Skytils - Hypixel Skyblock Quality of Life Mod
* Copyright (C) 2020-2023 Skytils
* Copyright (C) 2020-2024 Skytils
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
Expand All @@ -16,11 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package gg.skytils.skytilsmod.tweaker;
package gg.skytils.skytilsmod.utils;

import gg.essential.universal.UDesktop;
import gg.skytils.skytilsmod.Reference;
import net.minecraft.launchwrapper.Launch;
import org.apache.logging.log4j.LogManager;

import javax.swing.*;
Expand All @@ -44,32 +43,15 @@ private static boolean trySetDataUrl(String url) {
}
}

@SuppressWarnings("unused")
public static void setup() throws Throwable {
boolean isDev = Launch.classLoader.findResource("net/minecraft/world/World.class") != null;

try {
DependencyLoader.loadDependencies();
} catch (Throwable t) {
t.printStackTrace();
throw t;
}

registerTransformerExclusions(
"kotlin.",
"kotlinx.",
"gg.skytils.asmhelper.",
"gg.skytils.skytilsmod.tweaker.",
"gg.skytils.skytilsmod.asm."
);

public static void setup() throws Throwable {
for (final String url : dataURLCandidates) {
if (trySetDataUrl(url)) {
Reference.dataUrl = url;
break;
}
}
LogManager.getLogger().info("Data URL: " + Reference.dataUrl);
LogManager.getLogger().info("Data URL: {}", Reference.dataUrl);

try {
if (Integer.parseInt(makeRequest(Reference.dataUrl + "api/version").trim()) > Reference.apiVersion) {
Expand Down

0 comments on commit 24d1c76

Please sign in to comment.