Skip to content

Commit

Permalink
Fixes to Config Reloading
Browse files Browse the repository at this point in the history
Fixed Issues relating to the config not reloading all config options.
  • Loading branch information
XDPXI committed Aug 20, 2024
1 parent bcf190d commit 5074285
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions src/client/java/com/ztrolix/zlibs/ZtrolixLibsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public void onInitializeClient() {
LOGGER.info("Sodium Integration: Disabled!");
}
LOGGER.info("-- -- -- -- -- -- -- -- -- -- -- --");
if (config.features.customItems) {
LOGGER.info("Custom Items: Enabled!");
} else {
LOGGER.info("Custom Items: Disabled!");
}
if (config.features.customBlocks) {
LOGGER.info("Custom Blocks: Enabled!");
} else {
Expand All @@ -103,6 +108,11 @@ public void onInitializeClient() {
} else {
LOGGER.info("Custom Badges: Disabled!");
}
if (config.features.popup) {
LOGGER.info("Alerts: Enabled!");
} else {
LOGGER.info("Alerts: Disabled!");
}
LOGGER.info("-- -- -- -- -- -- -- -- -- -- -- --");
LOGGER.info("Ztrolix Libs - Applied Config!");
LOGGER.info("-----------------------------------");
Expand All @@ -125,6 +135,7 @@ public void onInitializeClient() {

public void applyConfig() {
ZLibsConfig config = AutoConfig.getConfigHolder(ZLibsConfig.class).getConfig();
String osName = System.getProperty("os.name").toLowerCase();

LOGGER.info("-----------------------------------");
LOGGER.info("Ztrolix Libs - Applying Config...");
Expand All @@ -151,14 +162,20 @@ public void applyConfig() {
}
LOGGER.info("-- -- -- -- -- -- -- -- -- -- -- --");
if (config.compatibility.discordRPC) {
DiscordRPCHandler.init();
ClientLifecycleEvents.CLIENT_STOPPING.register(client -> {
DiscordRPCHandler.shutdown();
});
LOGGER.info("Discord RPC: Enabled!");

if (osName.contains("win")) {
DiscordRPCHandler.init();
ClientLifecycleEvents.CLIENT_STOPPING.register(client -> {
DiscordRPCHandler.shutdown();
});
LOGGER.info("Discord RPC: Enabled!");
} else {
LOGGER.info("Discord RPC: Enabled!");
LOGGER.info("Running on an unsupported OS: " + osName);
}
} else {
DiscordRPCHandler.shutdown();
LOGGER.info("Discord RPC: Disabled!");
DiscordRPCHandler.shutdown();
}
if (config.compatibility.sodiumIntegration) {
CustomOptions.integrate();
Expand Down

0 comments on commit 5074285

Please sign in to comment.