Skip to content

Commit 70e7a82

Browse files
committed
feat: add functionality to disable Skyblocker dungeon map and handle update notifications for zen and krypt
1 parent b740c21 commit 70e7a82

File tree

6 files changed

+67
-8
lines changed

6 files changed

+67
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
1-
- fix: Typo in Resource Packs Wizard page and added missing key for Sophie's Hypixel Enhants. Should not be possible to apply from wizard page correctly.
2-
- fix: Added check for NPC in sender for Scam shield. Scam shield is no longer checking NPC messages.
3-
- feat: Added automatic config backups that run every three days. Apply them from the Configuration menu.
4-
- feat: Changed Gradle build system to use Stonecutter for easy multi-version support.
5-
- feat: Added config update system; this lets me update a specific config file with a modpack update or add configs for a new mod without having to apply configs for all mods.
6-
- feat: Added option to apply specific config files instead of the whole zip file.
7-
- chore: Fixed language files and improved readability.
1+
- feat: add code to force-close the Zen and Krypt update notification; this should be handled by the modpack.
2+
- feat: add function to disable Skyblocker dungeon map on startup; it is being replaced by Krypt in the new configs.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ org.gradle.configuration-cache=false
66
# Mod properties
77
mod.name=PackCore
88
mod.id=packcore
9-
mod.version=3.2.0
9+
mod.version=3.2.1
1010
mod.group=com.github.kd_gaming1
1111

1212
# Global dependencies

src/main/java/com/github/kd_gaming1/packcore/PackCore.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.github.kd_gaming1.packcore.command.scamshield.ScamShieldCommand;
55
import com.github.kd_gaming1.packcore.config.PackCoreConfig;
66
import com.github.kd_gaming1.packcore.config.backup.ScheduledBackupManager;
7+
import com.github.kd_gaming1.packcore.integration.skyblocker.DungeonMap;
78
import com.github.kd_gaming1.packcore.scamshield.ChatMessageInterceptor;
89
import com.github.kd_gaming1.packcore.scamshield.ScamShieldChatHandler;
910
import com.github.kd_gaming1.packcore.scamshield.detector.ScamDetector;
@@ -17,8 +18,11 @@
1718
import net.fabricmc.api.ClientModInitializer;
1819
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
1920
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
21+
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
2022
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
2123
import net.fabricmc.loader.api.FabricLoader;
24+
import net.minecraft.client.MinecraftClient;
25+
import net.minecraft.client.gui.screen.Screen;
2226
import net.minecraft.client.gui.screen.TitleScreen;
2327
import org.slf4j.Logger;
2428
import org.slf4j.LoggerFactory;
@@ -96,6 +100,24 @@ public void onInitializeClient() {
96100
PackCoreConfig.haveSetBobbyConfig = true;
97101
PackCoreConfig.write(MOD_ID);
98102
}
103+
104+
if (!PackCoreConfig.haveSetDungeonMapConfig) {
105+
DungeonMap.disableDungeonMap();
106+
PackCoreConfig.haveSetDungeonMapConfig = true;
107+
PackCoreConfig.write(MOD_ID);
108+
}
109+
110+
ClientTickEvents.END_CLIENT_TICK.register(client -> {
111+
try {
112+
Screen currentScreen = client.currentScreen;
113+
Class<?> zenClass = Class.forName("xyz.meowing.zen.updateChecker.UpdateGUI");
114+
Class<?> kryptClass = Class.forName("xyz.meowing.krypt.updateChecker.UpdateGUI");
115+
116+
if (zenClass.isInstance(currentScreen) || kryptClass.isInstance(currentScreen)) {
117+
MinecraftClient.getInstance().setScreen(null);
118+
}
119+
} catch (ClassNotFoundException ignored) {}
120+
});
99121
}
100122
public static ModpackInfo getModpackInfo() {
101123
return modpackInfo;

src/main/java/com/github/kd_gaming1/packcore/config/PackCoreConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ public class PackCoreConfig extends MidnightConfig {
6969
@Entry(category = CATEGORY_ADVANCED, name = "packcore.midnightconfig.have_set_bobby_config")
7070
public static boolean haveSetBobbyConfig = false;
7171

72+
@Entry(category = CATEGORY_ADVANCED, name = "packcore.midnightconfig.have_set_skyblocker_dungeon_map_config")
73+
public static boolean haveSetDungeonMapConfig = false;
74+
7275
@Hidden
7376
@Entry(category = CATEGORY_ADVANCED, name = "packcore.midnightconfig.setup_wizard_completed")
7477
public static boolean defaultConfigSuccessfullyApplied = false;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.github.kd_gaming1.packcore.integration.skyblocker;
2+
3+
import com.github.kd_gaming1.packcore.PackCore;
4+
5+
import java.lang.reflect.Method;
6+
7+
public class DungeonMap {
8+
9+
public static void disableDungeonMap() {
10+
try {
11+
Class<?> configManager = Class.forName("de.hysky.skyblocker.config.SkyblockerConfigManager");
12+
Method updateMethod = configManager.getDeclaredMethod("update", java.util.function.Consumer.class);
13+
14+
java.util.function.Consumer<Object> consumer = DungeonMap::updateDungeonMapConfig;
15+
16+
updateMethod.invoke(null, consumer);
17+
PackCore.LOGGER.info("Disabled Skyblocker Dungeon Map");
18+
19+
} catch (ClassNotFoundException e) {
20+
PackCore.LOGGER.info("Skyblocker not present");
21+
} catch (Exception e) {
22+
PackCore.LOGGER.warn("Could not update Skyblocker Dungeon Map config", e);
23+
}
24+
}
25+
26+
private static void updateDungeonMapConfig(Object config) {
27+
try {
28+
Object dungeons = config.getClass().getField("dungeons").get(config);
29+
Object dungeonMap = dungeons.getClass().getField("dungeonMap").get(dungeons);
30+
31+
dungeonMap.getClass().getField("enableMap").setBoolean(dungeonMap, false);
32+
} catch (Exception e) {
33+
PackCore.LOGGER.warn("Failed to update Dungeon Map config", e);
34+
}
35+
}
36+
}

src/main/resources/assets/packcore/lang/en_us.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
"packcore.midnightconfig.have_set_bobby_config": "Mark Bobby config as applied",
3939
"packcore.midnightconfig.have_set_bobby_config.tooltip": "Tracks if PackCore has applied Bobby’s settings. Change it to force the setup again.",
4040

41+
"packcore.midnightconfig.have_set_skyblocker_dungeon_map_config": "Mark Skyblocker Dungeon Map config as applied",
42+
"packcore.midnightconfig.have_set_skyblocker_dungeon_map_config.tooltip": "Tracks if PackCore has applied Skyblocker Dungeon Map config",
43+
4144
"packcore.midnightconfig.setup_wizard_completed": "Mark setup wizard as completed",
4245
"packcore.midnightconfig.setup_wizard_completed.tooltip": "Tracks if the setup wizard has been completed.",
4346

0 commit comments

Comments
 (0)