Skip to content

Commit

Permalink
Add biome-color deprecation notice message, pretty-up update-availabl…
Browse files Browse the repository at this point in the history
…e notification (#80)
  • Loading branch information
rndmorris authored Jan 13, 2025
1 parent acc4c4d commit f6ac958
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/main/java/dev/rndmorris/salisarcana/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
import dev.rndmorris.salisarcana.config.settings.CommandSettings;
import dev.rndmorris.salisarcana.lib.ResearchHelper;
import dev.rndmorris.salisarcana.network.NetworkHandler;
import dev.rndmorris.salisarcana.updater.Updater;
import dev.rndmorris.salisarcana.notifications.StartupNotifications;
import dev.rndmorris.salisarcana.notifications.Updater;

public class CommonProxy {

Expand All @@ -44,6 +45,9 @@ public void preInit(FMLPreInitializationEvent event) {
FMLCommonHandler.instance()
.bus()
.register(new Updater());
FMLCommonHandler.instance()
.bus()
.register(new StartupNotifications());
}

// load "Do your mod setup. Build whatever data structures you care about. Register recipes." (Remove if not needed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,26 @@

import dev.rndmorris.salisarcana.config.ConfigPhase;
import dev.rndmorris.salisarcana.config.settings.BiomeColorsSettings;
import dev.rndmorris.salisarcana.config.settings.ToggleSetting;

public class BiomeColorModule extends BaseConfigModule {

public final ToggleSetting acknowledgeDeprecation;

public final BiomeColorsSettings eerie;
public final BiomeColorsSettings eldritch;
public final BiomeColorsSettings magicalForest;
public final BiomeColorsSettings taint;

public BiomeColorModule() {
addSettings(
acknowledgeDeprecation = (ToggleSetting) new ToggleSetting(
this,
ConfigPhase.LATE,
"acknowledgeDeprecation",
"Set to true to acknowledge that the biome color module is being deprecated, and silence the warning message.")
.setEnabled(false)
.setCategory("_notices"),
eerie = new BiomeColorsSettings(
this,
ConfigPhase.EARLY,
Expand Down Expand Up @@ -61,6 +71,6 @@ public String getModuleId() {
@Nonnull
@Override
public String getModuleComment() {
return "Override the colors of TC4's biomes.";
return "Notice: This is broken for some users, and slated for removal in a future update.\nOverride the colors of TC4's biomes.";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package dev.rndmorris.salisarcana.notifications;

import net.minecraft.util.ChatComponentTranslation;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import dev.rndmorris.salisarcana.config.ConfigModuleRoot;

public class StartupNotifications {

private boolean noticeSent = false;

@SubscribeEvent
public void onLogin(PlayerEvent.PlayerLoggedInEvent event) {
final var biomeColors = ConfigModuleRoot.biomeColors;
if (noticeSent || !biomeColors.isEnabled() || biomeColors.acknowledgeDeprecation.isEnabled()) {
return;
}
noticeSent = true;
event.player.addChatMessage(new ChatComponentTranslation("salisarcana:biome_color_deprecation"));
event.player.addChatMessage(new ChatComponentTranslation("salisarcana:biome_color_deprecation_suppress"));
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.rndmorris.salisarcana.updater;
package dev.rndmorris.salisarcana.notifications;

import static dev.rndmorris.salisarcana.SalisArcana.LOG;

Expand Down Expand Up @@ -37,9 +37,9 @@ public void onLogin(PlayerEvent.PlayerLoggedInEvent event) {
hasCheckedVersion = true;
VersionInfo newVersion = checkForNewVersion();
if (newVersion != null) {
IChatComponent message = new ChatComponentTranslation(
"salisarcana:update_available",
newVersion.getVersionNumber());
event.player.addChatMessage(
new ChatComponentTranslation("salisarcana:update_available", newVersion.getVersionNumber()));
IChatComponent message = new ChatComponentTranslation("salisarcana:update_link");
message.getChatStyle()
.setChatClickEvent(
new ClickEvent(
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/assets/salisarcana/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ salisarcana:error.unexpected_value=Unexpected input "%s".
salisarcana:error.unknown_value=Unknown value "%s".
salisarcana:error.unknown_research=%s is not a known research key.

salisarcana:update_available=A new version of Salis Arcana is available (%s). Click here to open the download page.
salisarcana:biome_color_deprecation=§eNotice:§r The biome colors module is broken for some users, and slated for removal in a future update.
salisarcana:biome_color_deprecation_suppress= Set §7acknowledgeDeprecation§r to §7true§r in §7salisarcana/biome_colors.cfg§r to suppress this warning.
salisarcana:update_available=A new version of Salis Arcana is available (%s).
salisarcana:update_link= §9Click here to open the download page.§r

tc.research_name.CAP_iron=Iron Wand Caps
tc.research_name.ROD_wood=Wooden Wand Core
Expand Down

0 comments on commit f6ac958

Please sign in to comment.