diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/client/gui/screen/BetterStatsConfigScreen.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/client/gui/screen/BetterStatsConfigScreen.java index ad3f6bbd..4a195c3e 100644 --- a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/client/gui/screen/BetterStatsConfigScreen.java +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/client/gui/screen/BetterStatsConfigScreen.java @@ -9,6 +9,7 @@ import io.github.thecsdev.betterstats.BetterStats; import io.github.thecsdev.betterstats.BetterStatsConfig; import io.github.thecsdev.betterstats.api.client.gui.widget.ScrollBarWidget; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.config.TConfigPanelBuilder; import io.github.thecsdev.tcdcommons.api.client.gui.other.TFillColorElement; import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement; @@ -105,29 +106,29 @@ public BetterStatsConfigScreen(@Nullable Screen parent) { //debug mode config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.debug_mode"), + BST.config_debugMode(), BetterStatsConfig.DEBUG_MODE, checkbox -> BetterStatsConfig.DEBUG_MODE = checkbox.getChecked()); //gui smooth scroll config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll"), + BST.config_guiSmoothScroll(), config.guiSmoothScroll, checkbox -> config.guiSmoothScroll = checkbox.getChecked()); - config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll.tooltip"))); + config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_guiSmoothScroll_tooltip())); //gui mobs follow cursor config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_mob_follow_cursor"), + BST.config_guiMobsFollowCursor(), config.guiMobsFollowCursor, checkbox -> config.guiMobsFollowCursor = checkbox.getChecked()); //trust all servers bss network config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net"), + BST.config_trustAllServersBssNet(), config.trustAllServersBssNet, checkbox -> config.trustAllServersBssNet = checkbox.getChecked()); - config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net.tooltip"))); + config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_trustAllServersBssNet_tooltip())); } //configs for server-sided features @@ -135,13 +136,13 @@ public BetterStatsConfigScreen(@Nullable Screen parent) { //register commands config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.register_commands"), + BST.config_registerCommands(), config.registerCommands, checkbox -> config.registerCommands = checkbox.getChecked()); //enable stat announcement system config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.enable_sas"), + BST.config_enableSas(), config.enableServerSAS, checkbox -> config.enableServerSAS = checkbox.getChecked()); } diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/client/registry/BSClientPlayerBadges.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/client/registry/BSClientPlayerBadges.java index 4052bbca..a7f90cf4 100644 --- a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/client/registry/BSClientPlayerBadges.java +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/api/client/registry/BSClientPlayerBadges.java @@ -3,13 +3,13 @@ import static io.github.thecsdev.betterstats.api.client.gui.panel.BSComponentPanel.BS_WIDGETS_TEXTURE; import static io.github.thecsdev.tcdcommons.api.client.registry.TClientRegistries.PLAYER_BADGE_RENDERER; import static io.github.thecsdev.tcdcommons.api.registry.TRegistries.PLAYER_BADGE; -import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; import java.awt.Rectangle; import io.github.thecsdev.betterstats.BetterStats; import io.github.thecsdev.betterstats.api.client.badge.BSClientPlayerBadge; import io.github.thecsdev.betterstats.api.util.stats.SUItemStat; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.util.UITexture; import io.github.thecsdev.tcdcommons.api.client.render.badge.PBTextureRenderer; import io.github.thecsdev.tcdcommons.api.registry.TRegistries; @@ -38,20 +38,20 @@ public static final void register() {} { //create badges final var dedication = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.description")); + BST.pbadge_dedication_title(), + BST.pbadge_dedication_description()); final var loyalty = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.description")); + BST.pbadge_loyalty_title(), + BST.pbadge_loyalty_description()); final var the_next_generation = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.description")); + BST.pbadge_nextgen_title(), + BST.pbadge_nextgen_description()); final var adventurous_traveler = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.description")); + BST.pbadge_advtravel_title(), + BST.pbadge_advtravel_description()); final var perennial_survivor = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.description")); + BST.pbadge_psurvivor_title(), + BST.pbadge_psurvivor_description()); //set badge criteria dedication.setStatCriteria(sp -> (sp.getStatValue(Stats.CUSTOM, Stats.PLAY_TIME) > 20736000) ? 1 : 0); diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/screen/hud/BetterStatsHudScreen.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/screen/hud/BetterStatsHudScreen.java index 295d75ee..506a029e 100644 --- a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/screen/hud/BetterStatsHudScreen.java +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/screen/hud/BetterStatsHudScreen.java @@ -15,6 +15,7 @@ import io.github.thecsdev.betterstats.BetterStats; import io.github.thecsdev.betterstats.BetterStatsConfig; import io.github.thecsdev.betterstats.client.network.BetterStatsClientNetworkHandler; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreenWrapper; import io.github.thecsdev.tcdcommons.api.client.gui.screen.TWidgetHudScreen; import io.github.thecsdev.tcdcommons.api.client.gui.util.TDrawContext; @@ -34,12 +35,11 @@ public final class BetterStatsHudScreen extends TWidgetHudScreen implements IParentScreenProvider { // ================================================== - private static final String P = "betterstats.client.gui.screen.hud.betterstatshudscreen"; - public static final Text TEXT_TITLE = translatable(P); - public static final Text TEXT_TUTORIAL_1 = translatable(P + ".tutorial_1"); - public static final Text TEXT_TUTORIAL_2 = translatable(P + ".tutorial_2"); - public static final Text TEXT_TUTORIAL_3 = translatable(P + ".tutorial_3"); - public static final Text TEXT_LIVE_TOGGLE = translatable(P + ".live_stats_toggle"); + public static final Text TEXT_TITLE = BST.hud_title(); + public static final Text TEXT_TUTORIAL_1 = BST.hud_tutorial1(); + public static final Text TEXT_TUTORIAL_2 = BST.hud_tutorial2(); + public static final Text TEXT_TUTORIAL_3 = BST.hud_tutorial3(); + public static final Text TEXT_LIVE_TOGGLE = BST.hud_liveStatsToggle(); // public static final Identifier HUD_SCREEN_ID = new Identifier(getModID(), "stats_hud"); // -------------------------------------------------- diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/panel/StatsTabPanel.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/panel/StatsTabPanel.java index d982cd6c..76460847 100644 --- a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/panel/StatsTabPanel.java +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/panel/StatsTabPanel.java @@ -1,7 +1,6 @@ package io.github.thecsdev.betterstats.client.gui.stats.panel; import static io.github.thecsdev.betterstats.BetterStats.getModID; -import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; import java.util.Objects; @@ -16,6 +15,7 @@ import io.github.thecsdev.betterstats.api.client.util.StatFilterSettings; import io.github.thecsdev.betterstats.api.util.io.IStatsProvider; import io.github.thecsdev.betterstats.client.gui.stats.panel.StatFiltersPanel.StatFiltersPanelProxy; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement; import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement; import io.github.thecsdev.tcdcommons.api.client.gui.widget.TScrollBarWidget; @@ -29,7 +29,7 @@ public final class StatsTabPanel extends BSComponentPanel { // ================================================== - public static final Text TXT_NO_STATS_YET = translatable("betterstats.client.gui.stats.panel.statstabpanel.no_stats_yet"); + public static final Text TXT_NO_STATS_YET = BST.sTab_noStatsYet(); public static final Identifier FILTER_ID_SCROLL_CACHE = new Identifier(getModID(), "stats_scroll_cache"); // -------------------------------------------------- protected final StatsTabPanelProxy proxy; diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/BSConfigTab.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/BSConfigTab.java index 187cbfff..92a2c569 100644 --- a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/BSConfigTab.java +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/BSConfigTab.java @@ -9,6 +9,7 @@ import io.github.thecsdev.betterstats.api.client.gui.util.StatsTabUtils; import io.github.thecsdev.betterstats.api.client.registry.BSStatsTabs; import io.github.thecsdev.betterstats.api.client.registry.StatsTab; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.config.TConfigPanelBuilder; import io.github.thecsdev.tcdcommons.api.client.gui.widget.TButtonWidget; import net.minecraft.client.gui.tooltip.Tooltip; @@ -39,29 +40,29 @@ public final class BSConfigTab extends StatsTab { //debug mode this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.debug_mode"), + BST.config_debugMode(), BetterStatsConfig.DEBUG_MODE, checkbox -> BetterStatsConfig.DEBUG_MODE = checkbox.getChecked()); //gui smooth scroll this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll"), + BST.config_guiSmoothScroll(), config.guiSmoothScroll, checkbox -> config.guiSmoothScroll = checkbox.getChecked()); - this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll.tooltip"))); + this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_guiSmoothScroll_tooltip())); //gui mobs follow cursor this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_mob_follow_cursor"), + BST.config_guiMobsFollowCursor(), config.guiMobsFollowCursor, checkbox -> config.guiMobsFollowCursor = checkbox.getChecked()); //trust all servers bss network this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net"), + BST.config_trustAllServersBssNet(), config.trustAllServersBssNet, checkbox -> config.trustAllServersBssNet = checkbox.getChecked()); - this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net.tooltip"))); + this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_trustAllServersBssNet_tooltip())); } //configs for server-sided features @@ -69,13 +70,13 @@ public final class BSConfigTab extends StatsTab { //register commands this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.register_commands"), + BST.config_registerCommands(), config.registerCommands, checkbox -> config.registerCommands = checkbox.getChecked()); //enable stat announcement system this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.enable_sas"), + BST.config_enableSas(), config.enableServerSAS, checkbox -> config.enableServerSAS = checkbox.getChecked()); } diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/GeneralStatsTab.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/GeneralStatsTab.java index 45201a14..066f6fad 100644 --- a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/GeneralStatsTab.java +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/GeneralStatsTab.java @@ -23,6 +23,7 @@ import io.github.thecsdev.betterstats.api.util.stats.SUGeneralStat; import io.github.thecsdev.betterstats.client.gui.screen.hud.BetterStatsHudScreen; import io.github.thecsdev.betterstats.client.gui.screen.hud.entry.StatsHudGeneralEntry; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.other.TFillColorElement; import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement; import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement; @@ -75,7 +76,7 @@ ); final var ws2 = new CustomStatElement( wsp.getX(), wsp.getEndY() - CustomStatElement.HEIGHT, wsp.getWidth(), - translatable("betterstats.client.gui.stats.panel.statstabpanel.seed_sha256"), + BST.sTab_hashedSeed(), literal(Objects.toString(getBiomeAccessSeed(world.getBiomeAccess()))) ); wsp.addChild(ws1, false); @@ -97,7 +98,7 @@ statWidget.eContextMenu.register((__, cMenu) -> { - cMenu.addButton(translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"), ___ -> + cMenu.addButton(BST.hud_pinStat(), ___ -> { final var hud = BetterStatsHudScreen.getInstance(); hud.setParentScreen(MC_CLIENT.currentScreen); diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/ItemStatsTab.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/ItemStatsTab.java index 49a17d64..9a5b1bf8 100644 --- a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/ItemStatsTab.java +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/ItemStatsTab.java @@ -26,6 +26,7 @@ import io.github.thecsdev.betterstats.api.util.stats.SUItemStat; import io.github.thecsdev.betterstats.client.gui.screen.hud.BetterStatsHudScreen; import io.github.thecsdev.betterstats.client.gui.screen.hud.entry.StatsHudItemEntry; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement; import io.github.thecsdev.tcdcommons.api.util.annotations.Virtual; import net.minecraft.text.Text; @@ -96,7 +97,7 @@ { widget.eContextMenu.register((__, cMenu) -> { - cMenu.addButton(translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"), ___ -> + cMenu.addButton(BST.hud_pinStat(), ___ -> { final var hud = BetterStatsHudScreen.getInstance(); hud.setParentScreen(MC_CLIENT.currentScreen); diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/MobStatsTab.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/MobStatsTab.java index 67c94a10..38e518f9 100644 --- a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/MobStatsTab.java +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/MobStatsTab.java @@ -25,6 +25,7 @@ import io.github.thecsdev.betterstats.api.util.stats.SUMobStat; import io.github.thecsdev.betterstats.client.gui.screen.hud.BetterStatsHudScreen; import io.github.thecsdev.betterstats.client.gui.screen.hud.entry.StatsHudMobEntry; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement; import io.github.thecsdev.tcdcommons.api.util.annotations.Virtual; import net.minecraft.entity.SpawnGroup; @@ -97,7 +98,7 @@ { widget.eContextMenu.register((__, cMenu) -> { - cMenu.addButton(translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"), ___ -> + cMenu.addButton(BST.hud_pinStat(), ___ -> { final var hud = BetterStatsHudScreen.getInstance(); hud.setParentScreen(MC_CLIENT.currentScreen); diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/network/BetterStatsNetworkHandler.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/network/BetterStatsNetworkHandler.java index fbaa7b3a..54a57b4e 100644 --- a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/network/BetterStatsNetworkHandler.java +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/network/BetterStatsNetworkHandler.java @@ -1,12 +1,11 @@ package io.github.thecsdev.betterstats.network; -import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; - import java.util.WeakHashMap; import org.jetbrains.annotations.ApiStatus.Internal; import io.github.thecsdev.betterstats.BetterStats; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.events.server.PlayerManagerEvent; import io.github.thecsdev.tcdcommons.api.network.CustomPayloadNetwork; import io.netty.buffer.Unpooled; @@ -25,8 +24,8 @@ // ================================================== private BetterStatsNetworkHandler() {} // -------------------------------------------------- - public static final Text TXT_TOGGLE_TOOLTIP = translatable("betterstats.network.betterstatsnetworkhandler.toggle_tooltip"); - public static final Text TXT_CONSENT_WARNING = translatable("betterstats.network.betterstatsnetworkhandler.consent_warning"); + public static final Text TXT_TOGGLE_TOOLTIP = BST.net_toggleTooltip(); + public static final Text TXT_CONSENT_WARNING = BST.net_consentWarning(); // public static final int NETWORK_VERSION = 2; // diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/util/BST.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/util/BST.java new file mode 100644 index 00000000..d9cebe6c --- /dev/null +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/util/BST.java @@ -0,0 +1,61 @@ +package io.github.thecsdev.betterstats.util; + +import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; +import org.jetbrains.annotations.ApiStatus.Internal; + +import io.github.thecsdev.betterstats.BetterStats; +import net.minecraft.text.MutableText; +import net.minecraft.text.Text; + +/** + * {@link BetterStats} {@link Text}s. + * @apiNote Used to keep track of all of {@link BetterStats}'s {@link Text}s in one place. + */ +public final @Internal class BST +{ + // ================================================== + private BST() {} + // ================================================== + // -------------------------------------------------- + public static final MutableText sTab_noStatsYet() { return translatable("betterstats.client.gui.stats.panel.statstabpanel.no_stats_yet"); } + public static final MutableText sTab_hashedSeed() { return translatable("betterstats.client.gui.stats.panel.statstabpanel.seed_sha256"); } + // -------------------------------------------------- + public static final MutableText config_debugMode() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.debug_mode"); } + public static final MutableText config_guiSmoothScroll() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll"); } + public static final MutableText config_guiSmoothScroll_tooltip() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll.tooltip"); } + public static final MutableText config_guiMobsFollowCursor() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_mob_follow_cursor"); } + public static final MutableText config_trustAllServersBssNet() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net"); } + public static final MutableText config_trustAllServersBssNet_tooltip() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net.tooltip"); } + public static final MutableText config_registerCommands() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.register_commands"); } + public static final MutableText config_enableSas() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.enable_sas"); } + // -------------------------------------------------- + public static final MutableText pbadge_dedication_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.title"); } + public static final MutableText pbadge_dedication_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.description"); } + public static final MutableText pbadge_loyalty_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.title"); } + public static final MutableText pbadge_loyalty_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.description"); } + public static final MutableText pbadge_nextgen_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.title"); } + public static final MutableText pbadge_nextgen_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.description"); } + public static final MutableText pbadge_advtravel_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.title"); } + public static final MutableText pbadge_advtravel_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.description"); } + public static final MutableText pbadge_psurvivor_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.title"); } + public static final MutableText pbadge_psurvivor_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.description"); } + // -------------------------------------------------- + public static final MutableText hud_title() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen"); } + public static final MutableText hud_pinStat() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"); } + public static final MutableText hud_liveStatsToggle() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.live_stats_toggle"); } + public static final MutableText hud_tutorial1() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.tutorial_1"); } + public static final MutableText hud_tutorial2() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.tutorial_2"); } + public static final MutableText hud_tutorial3() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.tutorial_3"); } + // -------------------------------------------------- + public static final MutableText net_toggleTooltip() { return translatable("betterstats.network.betterstatsnetworkhandler.toggle_tooltip"); } + public static final MutableText net_consentWarning() { return translatable("betterstats.network.betterstatsnetworkhandler.consent_warning"); } + // -------------------------------------------------- + public static final MutableText sas_firstMine(Text player, Text block) { return translatable("betterstats.util.stats.statannouncementsystem.first_mine", player, block); } + public static final MutableText sas_firstCraft(Text player, Text item) { return translatable("betterstats.util.stats.statannouncementsystem.first_craft", player, item); } + public static final MutableText sas_firstDeath(Text player) { return translatable("betterstats.util.stats.statannouncementsystem.first_death", player); } + public static final MutableText sas_firstDeath_hc1(Text player) { return translatable("betterstats.util.stats.statannouncementsystem.first_death.hc1", player); } + public static final MutableText sas_firstKill(Text player, Text entity) { return translatable("betterstats.util.stats.statannouncementsystem.first_kill", player, entity); } + public static final MutableText sas_firstDeathTo(Text player, Text entity) { return translatable("betterstats.util.stats.statannouncementsystem.first_death_to", player, entity); } + public static final MutableText sas_custom(Text player, Text stat, Text value) { return translatable("betterstats.util.stats.statannouncementsystem.custom", player, stat, value); } + // ================================================== +} \ No newline at end of file diff --git a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/util/stats/StatAnnouncementSystem.java b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/util/stats/StatAnnouncementSystem.java index a291f735..b92fcdd4 100644 --- a/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/util/stats/StatAnnouncementSystem.java +++ b/betterstats-3-fabric-1.20.1/src/main/java/io/github/thecsdev/betterstats/util/stats/StatAnnouncementSystem.java @@ -1,7 +1,7 @@ package io.github.thecsdev.betterstats.util.stats; +import static io.github.thecsdev.betterstats.api.util.stats.SUGeneralStat.getGeneralStatText; import static io.github.thecsdev.tcdcommons.api.util.TextUtils.literal; -import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; import java.util.HashSet; import java.util.Objects; @@ -13,6 +13,7 @@ import io.github.thecsdev.betterstats.BetterStats; import io.github.thecsdev.betterstats.BetterStatsConfig; import io.github.thecsdev.betterstats.network.BetterStatsNetworkHandler; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.TCDCommons; import net.minecraft.block.Block; import net.minecraft.entity.EntityType; @@ -31,7 +32,6 @@ import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import net.minecraft.util.InvalidIdentifierException; -import static io.github.thecsdev.betterstats.api.util.stats.SUGeneralStat.getGeneralStatText; /** * A {@link Class} that handles announcing players doing @@ -42,15 +42,6 @@ public final @Internal class StatAnnouncementSystem { // ================================================== - private static final String P = "betterstats.util.stats.statannouncementsystem."; //prefix - public static final String TXT_FIRST_MINED = P + "first_mine"; - public static final String TXT_FIRST_CRAFTED = P + "first_craft"; - public static final String TXT_FIRST_DEATH = P + "first_death"; - public static final String TXT_FIRST_DEATH_HC1 = P + "first_death.hc1"; - public static final String TXT_FIRST_KILLED = P + "first_kill"; - public static final String TXT_FIRST_KILLED_BY = P + "first_death_to"; - public static final String TXT_CUSTOM = P + "custom"; - // private static final Text WATERMARK; private static final BetterStatsConfig BSSC; private static final SASConfig SASC; @@ -277,7 +268,7 @@ public static final void broadcastFirstMine(ServerPlayerEntity player, Block min final var pText = formatPlayerText(player); final var bText = formatBlockText(minedBlock); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_FIRST_MINED, pText, bText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_firstMine(pText, bText)), literal("").append(WATERMARK).append(" ") .append(pText).append(" just mined their first ").append(bText).append(".")); } @@ -293,7 +284,7 @@ public static final void broadcastFirstCraft(ServerPlayerEntity player, Item cra final var pText = formatPlayerText(player); final var iText = formatItemText(craftedItem); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_FIRST_CRAFTED, pText, iText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_firstCraft(pText, iText)), literal("").append(WATERMARK).append(" ") .append(pText).append(" just crafted their first ").append(iText).append(".")); } @@ -309,7 +300,7 @@ public static final void broadcastFirstKilled(ServerPlayerEntity player, EntityT final var pText = formatPlayerText(player); final var etText = formatEntityTypeText(victimType); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_FIRST_KILLED, pText, etText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_firstKill(pText, etText)), literal("").append(WATERMARK).append(" ").append(pText) .append(" just killed a ").append(etText).append(" for their first time.")); } @@ -325,7 +316,7 @@ public static final void broadcastFirstKilledBy(ServerPlayerEntity player, Entit final var pText = formatPlayerText(player); final var etText = formatEntityTypeText(killerType); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_FIRST_KILLED_BY, pText, etText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_firstDeathTo(pText, etText)), literal("").append(WATERMARK).append(" ").append(pText) .append(" just died to a ").append(etText).append(" for their first time.")); } @@ -338,12 +329,12 @@ public static final void broadcastFirstKilledBy(ServerPlayerEntity player, Entit public static final void broadcastFirstDeath(ServerPlayerEntity player) { final var hardcore = player.getServer().isHardcore(); - final var key = hardcore ? TXT_FIRST_DEATH_HC1 : TXT_FIRST_DEATH; final var literalBrightSide = hardcore ? " On the bright side, it likely won't happen again." : ""; final var pText = formatPlayerText(player); + final var translatableText = hardcore ? BST.sas_firstDeath_hc1(pText) : BST.sas_firstDeath(pText); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(key, pText)), + literal("").append(WATERMARK).append(" ").append(translatableText), literal("").append(WATERMARK).append(" ") .append(pText).append(" died for their first time." + literalBrightSide)); } @@ -362,7 +353,7 @@ public static final void broadcastFirstCustomStat( final var sText = literal("").append(getGeneralStatText(stat)).formatted(Formatting.GRAY); final var vText = literal(statValue).formatted(Formatting.GREEN); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_CUSTOM, pText, sText, vText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_custom(pText, sText, vText)), literal("").append(WATERMARK).append(" ").append(pText) .append(" just increased their ").append(sText).append(" stat value to ") .append(vText).append(".")); diff --git a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/api/client/gui/screen/BetterStatsConfigScreen.java b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/api/client/gui/screen/BetterStatsConfigScreen.java index ad3f6bbd..4a195c3e 100644 --- a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/api/client/gui/screen/BetterStatsConfigScreen.java +++ b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/api/client/gui/screen/BetterStatsConfigScreen.java @@ -9,6 +9,7 @@ import io.github.thecsdev.betterstats.BetterStats; import io.github.thecsdev.betterstats.BetterStatsConfig; import io.github.thecsdev.betterstats.api.client.gui.widget.ScrollBarWidget; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.config.TConfigPanelBuilder; import io.github.thecsdev.tcdcommons.api.client.gui.other.TFillColorElement; import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement; @@ -105,29 +106,29 @@ public BetterStatsConfigScreen(@Nullable Screen parent) { //debug mode config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.debug_mode"), + BST.config_debugMode(), BetterStatsConfig.DEBUG_MODE, checkbox -> BetterStatsConfig.DEBUG_MODE = checkbox.getChecked()); //gui smooth scroll config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll"), + BST.config_guiSmoothScroll(), config.guiSmoothScroll, checkbox -> config.guiSmoothScroll = checkbox.getChecked()); - config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll.tooltip"))); + config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_guiSmoothScroll_tooltip())); //gui mobs follow cursor config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_mob_follow_cursor"), + BST.config_guiMobsFollowCursor(), config.guiMobsFollowCursor, checkbox -> config.guiMobsFollowCursor = checkbox.getChecked()); //trust all servers bss network config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net"), + BST.config_trustAllServersBssNet(), config.trustAllServersBssNet, checkbox -> config.trustAllServersBssNet = checkbox.getChecked()); - config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net.tooltip"))); + config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_trustAllServersBssNet_tooltip())); } //configs for server-sided features @@ -135,13 +136,13 @@ public BetterStatsConfigScreen(@Nullable Screen parent) { //register commands config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.register_commands"), + BST.config_registerCommands(), config.registerCommands, checkbox -> config.registerCommands = checkbox.getChecked()); //enable stat announcement system config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.enable_sas"), + BST.config_enableSas(), config.enableServerSAS, checkbox -> config.enableServerSAS = checkbox.getChecked()); } diff --git a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/api/client/registry/BSClientPlayerBadges.java b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/api/client/registry/BSClientPlayerBadges.java index 4052bbca..a7f90cf4 100644 --- a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/api/client/registry/BSClientPlayerBadges.java +++ b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/api/client/registry/BSClientPlayerBadges.java @@ -3,13 +3,13 @@ import static io.github.thecsdev.betterstats.api.client.gui.panel.BSComponentPanel.BS_WIDGETS_TEXTURE; import static io.github.thecsdev.tcdcommons.api.client.registry.TClientRegistries.PLAYER_BADGE_RENDERER; import static io.github.thecsdev.tcdcommons.api.registry.TRegistries.PLAYER_BADGE; -import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; import java.awt.Rectangle; import io.github.thecsdev.betterstats.BetterStats; import io.github.thecsdev.betterstats.api.client.badge.BSClientPlayerBadge; import io.github.thecsdev.betterstats.api.util.stats.SUItemStat; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.util.UITexture; import io.github.thecsdev.tcdcommons.api.client.render.badge.PBTextureRenderer; import io.github.thecsdev.tcdcommons.api.registry.TRegistries; @@ -38,20 +38,20 @@ public static final void register() {} { //create badges final var dedication = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.description")); + BST.pbadge_dedication_title(), + BST.pbadge_dedication_description()); final var loyalty = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.description")); + BST.pbadge_loyalty_title(), + BST.pbadge_loyalty_description()); final var the_next_generation = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.description")); + BST.pbadge_nextgen_title(), + BST.pbadge_nextgen_description()); final var adventurous_traveler = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.description")); + BST.pbadge_advtravel_title(), + BST.pbadge_advtravel_description()); final var perennial_survivor = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.description")); + BST.pbadge_psurvivor_title(), + BST.pbadge_psurvivor_description()); //set badge criteria dedication.setStatCriteria(sp -> (sp.getStatValue(Stats.CUSTOM, Stats.PLAY_TIME) > 20736000) ? 1 : 0); diff --git a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/screen/hud/BetterStatsHudScreen.java b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/screen/hud/BetterStatsHudScreen.java index 295d75ee..506a029e 100644 --- a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/screen/hud/BetterStatsHudScreen.java +++ b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/screen/hud/BetterStatsHudScreen.java @@ -15,6 +15,7 @@ import io.github.thecsdev.betterstats.BetterStats; import io.github.thecsdev.betterstats.BetterStatsConfig; import io.github.thecsdev.betterstats.client.network.BetterStatsClientNetworkHandler; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreenWrapper; import io.github.thecsdev.tcdcommons.api.client.gui.screen.TWidgetHudScreen; import io.github.thecsdev.tcdcommons.api.client.gui.util.TDrawContext; @@ -34,12 +35,11 @@ public final class BetterStatsHudScreen extends TWidgetHudScreen implements IParentScreenProvider { // ================================================== - private static final String P = "betterstats.client.gui.screen.hud.betterstatshudscreen"; - public static final Text TEXT_TITLE = translatable(P); - public static final Text TEXT_TUTORIAL_1 = translatable(P + ".tutorial_1"); - public static final Text TEXT_TUTORIAL_2 = translatable(P + ".tutorial_2"); - public static final Text TEXT_TUTORIAL_3 = translatable(P + ".tutorial_3"); - public static final Text TEXT_LIVE_TOGGLE = translatable(P + ".live_stats_toggle"); + public static final Text TEXT_TITLE = BST.hud_title(); + public static final Text TEXT_TUTORIAL_1 = BST.hud_tutorial1(); + public static final Text TEXT_TUTORIAL_2 = BST.hud_tutorial2(); + public static final Text TEXT_TUTORIAL_3 = BST.hud_tutorial3(); + public static final Text TEXT_LIVE_TOGGLE = BST.hud_liveStatsToggle(); // public static final Identifier HUD_SCREEN_ID = new Identifier(getModID(), "stats_hud"); // -------------------------------------------------- diff --git a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/panel/StatsTabPanel.java b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/panel/StatsTabPanel.java index d982cd6c..76460847 100644 --- a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/panel/StatsTabPanel.java +++ b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/panel/StatsTabPanel.java @@ -1,7 +1,6 @@ package io.github.thecsdev.betterstats.client.gui.stats.panel; import static io.github.thecsdev.betterstats.BetterStats.getModID; -import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; import java.util.Objects; @@ -16,6 +15,7 @@ import io.github.thecsdev.betterstats.api.client.util.StatFilterSettings; import io.github.thecsdev.betterstats.api.util.io.IStatsProvider; import io.github.thecsdev.betterstats.client.gui.stats.panel.StatFiltersPanel.StatFiltersPanelProxy; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement; import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement; import io.github.thecsdev.tcdcommons.api.client.gui.widget.TScrollBarWidget; @@ -29,7 +29,7 @@ public final class StatsTabPanel extends BSComponentPanel { // ================================================== - public static final Text TXT_NO_STATS_YET = translatable("betterstats.client.gui.stats.panel.statstabpanel.no_stats_yet"); + public static final Text TXT_NO_STATS_YET = BST.sTab_noStatsYet(); public static final Identifier FILTER_ID_SCROLL_CACHE = new Identifier(getModID(), "stats_scroll_cache"); // -------------------------------------------------- protected final StatsTabPanelProxy proxy; diff --git a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/BSConfigTab.java b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/BSConfigTab.java index 187cbfff..92a2c569 100644 --- a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/BSConfigTab.java +++ b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/BSConfigTab.java @@ -9,6 +9,7 @@ import io.github.thecsdev.betterstats.api.client.gui.util.StatsTabUtils; import io.github.thecsdev.betterstats.api.client.registry.BSStatsTabs; import io.github.thecsdev.betterstats.api.client.registry.StatsTab; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.config.TConfigPanelBuilder; import io.github.thecsdev.tcdcommons.api.client.gui.widget.TButtonWidget; import net.minecraft.client.gui.tooltip.Tooltip; @@ -39,29 +40,29 @@ public final class BSConfigTab extends StatsTab { //debug mode this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.debug_mode"), + BST.config_debugMode(), BetterStatsConfig.DEBUG_MODE, checkbox -> BetterStatsConfig.DEBUG_MODE = checkbox.getChecked()); //gui smooth scroll this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll"), + BST.config_guiSmoothScroll(), config.guiSmoothScroll, checkbox -> config.guiSmoothScroll = checkbox.getChecked()); - this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll.tooltip"))); + this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_guiSmoothScroll_tooltip())); //gui mobs follow cursor this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_mob_follow_cursor"), + BST.config_guiMobsFollowCursor(), config.guiMobsFollowCursor, checkbox -> config.guiMobsFollowCursor = checkbox.getChecked()); //trust all servers bss network this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net"), + BST.config_trustAllServersBssNet(), config.trustAllServersBssNet, checkbox -> config.trustAllServersBssNet = checkbox.getChecked()); - this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net.tooltip"))); + this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_trustAllServersBssNet_tooltip())); } //configs for server-sided features @@ -69,13 +70,13 @@ public final class BSConfigTab extends StatsTab { //register commands this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.register_commands"), + BST.config_registerCommands(), config.registerCommands, checkbox -> config.registerCommands = checkbox.getChecked()); //enable stat announcement system this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.enable_sas"), + BST.config_enableSas(), config.enableServerSAS, checkbox -> config.enableServerSAS = checkbox.getChecked()); } diff --git a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/GeneralStatsTab.java b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/GeneralStatsTab.java index 45201a14..066f6fad 100644 --- a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/GeneralStatsTab.java +++ b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/GeneralStatsTab.java @@ -23,6 +23,7 @@ import io.github.thecsdev.betterstats.api.util.stats.SUGeneralStat; import io.github.thecsdev.betterstats.client.gui.screen.hud.BetterStatsHudScreen; import io.github.thecsdev.betterstats.client.gui.screen.hud.entry.StatsHudGeneralEntry; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.other.TFillColorElement; import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement; import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement; @@ -75,7 +76,7 @@ ); final var ws2 = new CustomStatElement( wsp.getX(), wsp.getEndY() - CustomStatElement.HEIGHT, wsp.getWidth(), - translatable("betterstats.client.gui.stats.panel.statstabpanel.seed_sha256"), + BST.sTab_hashedSeed(), literal(Objects.toString(getBiomeAccessSeed(world.getBiomeAccess()))) ); wsp.addChild(ws1, false); @@ -97,7 +98,7 @@ statWidget.eContextMenu.register((__, cMenu) -> { - cMenu.addButton(translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"), ___ -> + cMenu.addButton(BST.hud_pinStat(), ___ -> { final var hud = BetterStatsHudScreen.getInstance(); hud.setParentScreen(MC_CLIENT.currentScreen); diff --git a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/ItemStatsTab.java b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/ItemStatsTab.java index 49a17d64..9a5b1bf8 100644 --- a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/ItemStatsTab.java +++ b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/ItemStatsTab.java @@ -26,6 +26,7 @@ import io.github.thecsdev.betterstats.api.util.stats.SUItemStat; import io.github.thecsdev.betterstats.client.gui.screen.hud.BetterStatsHudScreen; import io.github.thecsdev.betterstats.client.gui.screen.hud.entry.StatsHudItemEntry; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement; import io.github.thecsdev.tcdcommons.api.util.annotations.Virtual; import net.minecraft.text.Text; @@ -96,7 +97,7 @@ { widget.eContextMenu.register((__, cMenu) -> { - cMenu.addButton(translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"), ___ -> + cMenu.addButton(BST.hud_pinStat(), ___ -> { final var hud = BetterStatsHudScreen.getInstance(); hud.setParentScreen(MC_CLIENT.currentScreen); diff --git a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/MobStatsTab.java b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/MobStatsTab.java index 67c94a10..38e518f9 100644 --- a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/MobStatsTab.java +++ b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/MobStatsTab.java @@ -25,6 +25,7 @@ import io.github.thecsdev.betterstats.api.util.stats.SUMobStat; import io.github.thecsdev.betterstats.client.gui.screen.hud.BetterStatsHudScreen; import io.github.thecsdev.betterstats.client.gui.screen.hud.entry.StatsHudMobEntry; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement; import io.github.thecsdev.tcdcommons.api.util.annotations.Virtual; import net.minecraft.entity.SpawnGroup; @@ -97,7 +98,7 @@ { widget.eContextMenu.register((__, cMenu) -> { - cMenu.addButton(translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"), ___ -> + cMenu.addButton(BST.hud_pinStat(), ___ -> { final var hud = BetterStatsHudScreen.getInstance(); hud.setParentScreen(MC_CLIENT.currentScreen); diff --git a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/network/BetterStatsNetworkHandler.java b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/network/BetterStatsNetworkHandler.java index e8e961d8..c8909359 100644 --- a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/network/BetterStatsNetworkHandler.java +++ b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/network/BetterStatsNetworkHandler.java @@ -1,12 +1,11 @@ package io.github.thecsdev.betterstats.network; -import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; - import java.util.WeakHashMap; import org.jetbrains.annotations.ApiStatus.Internal; import io.github.thecsdev.betterstats.BetterStats; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.events.server.PlayerManagerEvent; import io.github.thecsdev.tcdcommons.api.network.CustomPayloadNetwork; import io.github.thecsdev.tcdcommons.api.network.packet.TCustomPayload; @@ -25,8 +24,8 @@ // ================================================== private BetterStatsNetworkHandler() {} // -------------------------------------------------- - public static final Text TXT_TOGGLE_TOOLTIP = translatable("betterstats.network.betterstatsnetworkhandler.toggle_tooltip"); - public static final Text TXT_CONSENT_WARNING = translatable("betterstats.network.betterstatsnetworkhandler.consent_warning"); + public static final Text TXT_TOGGLE_TOOLTIP = BST.net_toggleTooltip(); + public static final Text TXT_CONSENT_WARNING = BST.net_consentWarning(); // public static final int NETWORK_VERSION = 2; // diff --git a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/util/BST.java b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/util/BST.java new file mode 100644 index 00000000..d9cebe6c --- /dev/null +++ b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/util/BST.java @@ -0,0 +1,61 @@ +package io.github.thecsdev.betterstats.util; + +import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; +import org.jetbrains.annotations.ApiStatus.Internal; + +import io.github.thecsdev.betterstats.BetterStats; +import net.minecraft.text.MutableText; +import net.minecraft.text.Text; + +/** + * {@link BetterStats} {@link Text}s. + * @apiNote Used to keep track of all of {@link BetterStats}'s {@link Text}s in one place. + */ +public final @Internal class BST +{ + // ================================================== + private BST() {} + // ================================================== + // -------------------------------------------------- + public static final MutableText sTab_noStatsYet() { return translatable("betterstats.client.gui.stats.panel.statstabpanel.no_stats_yet"); } + public static final MutableText sTab_hashedSeed() { return translatable("betterstats.client.gui.stats.panel.statstabpanel.seed_sha256"); } + // -------------------------------------------------- + public static final MutableText config_debugMode() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.debug_mode"); } + public static final MutableText config_guiSmoothScroll() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll"); } + public static final MutableText config_guiSmoothScroll_tooltip() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll.tooltip"); } + public static final MutableText config_guiMobsFollowCursor() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_mob_follow_cursor"); } + public static final MutableText config_trustAllServersBssNet() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net"); } + public static final MutableText config_trustAllServersBssNet_tooltip() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net.tooltip"); } + public static final MutableText config_registerCommands() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.register_commands"); } + public static final MutableText config_enableSas() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.enable_sas"); } + // -------------------------------------------------- + public static final MutableText pbadge_dedication_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.title"); } + public static final MutableText pbadge_dedication_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.description"); } + public static final MutableText pbadge_loyalty_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.title"); } + public static final MutableText pbadge_loyalty_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.description"); } + public static final MutableText pbadge_nextgen_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.title"); } + public static final MutableText pbadge_nextgen_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.description"); } + public static final MutableText pbadge_advtravel_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.title"); } + public static final MutableText pbadge_advtravel_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.description"); } + public static final MutableText pbadge_psurvivor_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.title"); } + public static final MutableText pbadge_psurvivor_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.description"); } + // -------------------------------------------------- + public static final MutableText hud_title() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen"); } + public static final MutableText hud_pinStat() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"); } + public static final MutableText hud_liveStatsToggle() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.live_stats_toggle"); } + public static final MutableText hud_tutorial1() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.tutorial_1"); } + public static final MutableText hud_tutorial2() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.tutorial_2"); } + public static final MutableText hud_tutorial3() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.tutorial_3"); } + // -------------------------------------------------- + public static final MutableText net_toggleTooltip() { return translatable("betterstats.network.betterstatsnetworkhandler.toggle_tooltip"); } + public static final MutableText net_consentWarning() { return translatable("betterstats.network.betterstatsnetworkhandler.consent_warning"); } + // -------------------------------------------------- + public static final MutableText sas_firstMine(Text player, Text block) { return translatable("betterstats.util.stats.statannouncementsystem.first_mine", player, block); } + public static final MutableText sas_firstCraft(Text player, Text item) { return translatable("betterstats.util.stats.statannouncementsystem.first_craft", player, item); } + public static final MutableText sas_firstDeath(Text player) { return translatable("betterstats.util.stats.statannouncementsystem.first_death", player); } + public static final MutableText sas_firstDeath_hc1(Text player) { return translatable("betterstats.util.stats.statannouncementsystem.first_death.hc1", player); } + public static final MutableText sas_firstKill(Text player, Text entity) { return translatable("betterstats.util.stats.statannouncementsystem.first_kill", player, entity); } + public static final MutableText sas_firstDeathTo(Text player, Text entity) { return translatable("betterstats.util.stats.statannouncementsystem.first_death_to", player, entity); } + public static final MutableText sas_custom(Text player, Text stat, Text value) { return translatable("betterstats.util.stats.statannouncementsystem.custom", player, stat, value); } + // ================================================== +} \ No newline at end of file diff --git a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/util/stats/StatAnnouncementSystem.java b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/util/stats/StatAnnouncementSystem.java index a291f735..b92fcdd4 100644 --- a/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/util/stats/StatAnnouncementSystem.java +++ b/betterstats-3-fabric-1.20.2/src/main/java/io/github/thecsdev/betterstats/util/stats/StatAnnouncementSystem.java @@ -1,7 +1,7 @@ package io.github.thecsdev.betterstats.util.stats; +import static io.github.thecsdev.betterstats.api.util.stats.SUGeneralStat.getGeneralStatText; import static io.github.thecsdev.tcdcommons.api.util.TextUtils.literal; -import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; import java.util.HashSet; import java.util.Objects; @@ -13,6 +13,7 @@ import io.github.thecsdev.betterstats.BetterStats; import io.github.thecsdev.betterstats.BetterStatsConfig; import io.github.thecsdev.betterstats.network.BetterStatsNetworkHandler; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.TCDCommons; import net.minecraft.block.Block; import net.minecraft.entity.EntityType; @@ -31,7 +32,6 @@ import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import net.minecraft.util.InvalidIdentifierException; -import static io.github.thecsdev.betterstats.api.util.stats.SUGeneralStat.getGeneralStatText; /** * A {@link Class} that handles announcing players doing @@ -42,15 +42,6 @@ public final @Internal class StatAnnouncementSystem { // ================================================== - private static final String P = "betterstats.util.stats.statannouncementsystem."; //prefix - public static final String TXT_FIRST_MINED = P + "first_mine"; - public static final String TXT_FIRST_CRAFTED = P + "first_craft"; - public static final String TXT_FIRST_DEATH = P + "first_death"; - public static final String TXT_FIRST_DEATH_HC1 = P + "first_death.hc1"; - public static final String TXT_FIRST_KILLED = P + "first_kill"; - public static final String TXT_FIRST_KILLED_BY = P + "first_death_to"; - public static final String TXT_CUSTOM = P + "custom"; - // private static final Text WATERMARK; private static final BetterStatsConfig BSSC; private static final SASConfig SASC; @@ -277,7 +268,7 @@ public static final void broadcastFirstMine(ServerPlayerEntity player, Block min final var pText = formatPlayerText(player); final var bText = formatBlockText(minedBlock); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_FIRST_MINED, pText, bText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_firstMine(pText, bText)), literal("").append(WATERMARK).append(" ") .append(pText).append(" just mined their first ").append(bText).append(".")); } @@ -293,7 +284,7 @@ public static final void broadcastFirstCraft(ServerPlayerEntity player, Item cra final var pText = formatPlayerText(player); final var iText = formatItemText(craftedItem); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_FIRST_CRAFTED, pText, iText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_firstCraft(pText, iText)), literal("").append(WATERMARK).append(" ") .append(pText).append(" just crafted their first ").append(iText).append(".")); } @@ -309,7 +300,7 @@ public static final void broadcastFirstKilled(ServerPlayerEntity player, EntityT final var pText = formatPlayerText(player); final var etText = formatEntityTypeText(victimType); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_FIRST_KILLED, pText, etText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_firstKill(pText, etText)), literal("").append(WATERMARK).append(" ").append(pText) .append(" just killed a ").append(etText).append(" for their first time.")); } @@ -325,7 +316,7 @@ public static final void broadcastFirstKilledBy(ServerPlayerEntity player, Entit final var pText = formatPlayerText(player); final var etText = formatEntityTypeText(killerType); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_FIRST_KILLED_BY, pText, etText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_firstDeathTo(pText, etText)), literal("").append(WATERMARK).append(" ").append(pText) .append(" just died to a ").append(etText).append(" for their first time.")); } @@ -338,12 +329,12 @@ public static final void broadcastFirstKilledBy(ServerPlayerEntity player, Entit public static final void broadcastFirstDeath(ServerPlayerEntity player) { final var hardcore = player.getServer().isHardcore(); - final var key = hardcore ? TXT_FIRST_DEATH_HC1 : TXT_FIRST_DEATH; final var literalBrightSide = hardcore ? " On the bright side, it likely won't happen again." : ""; final var pText = formatPlayerText(player); + final var translatableText = hardcore ? BST.sas_firstDeath_hc1(pText) : BST.sas_firstDeath(pText); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(key, pText)), + literal("").append(WATERMARK).append(" ").append(translatableText), literal("").append(WATERMARK).append(" ") .append(pText).append(" died for their first time." + literalBrightSide)); } @@ -362,7 +353,7 @@ public static final void broadcastFirstCustomStat( final var sText = literal("").append(getGeneralStatText(stat)).formatted(Formatting.GRAY); final var vText = literal(statValue).formatted(Formatting.GREEN); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_CUSTOM, pText, sText, vText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_custom(pText, sText, vText)), literal("").append(WATERMARK).append(" ").append(pText) .append(" just increased their ").append(sText).append(" stat value to ") .append(vText).append(".")); diff --git a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/api/client/gui/screen/BetterStatsConfigScreen.java b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/api/client/gui/screen/BetterStatsConfigScreen.java index ad3f6bbd..4a195c3e 100644 --- a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/api/client/gui/screen/BetterStatsConfigScreen.java +++ b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/api/client/gui/screen/BetterStatsConfigScreen.java @@ -9,6 +9,7 @@ import io.github.thecsdev.betterstats.BetterStats; import io.github.thecsdev.betterstats.BetterStatsConfig; import io.github.thecsdev.betterstats.api.client.gui.widget.ScrollBarWidget; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.config.TConfigPanelBuilder; import io.github.thecsdev.tcdcommons.api.client.gui.other.TFillColorElement; import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement; @@ -105,29 +106,29 @@ public BetterStatsConfigScreen(@Nullable Screen parent) { //debug mode config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.debug_mode"), + BST.config_debugMode(), BetterStatsConfig.DEBUG_MODE, checkbox -> BetterStatsConfig.DEBUG_MODE = checkbox.getChecked()); //gui smooth scroll config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll"), + BST.config_guiSmoothScroll(), config.guiSmoothScroll, checkbox -> config.guiSmoothScroll = checkbox.getChecked()); - config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll.tooltip"))); + config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_guiSmoothScroll_tooltip())); //gui mobs follow cursor config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_mob_follow_cursor"), + BST.config_guiMobsFollowCursor(), config.guiMobsFollowCursor, checkbox -> config.guiMobsFollowCursor = checkbox.getChecked()); //trust all servers bss network config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net"), + BST.config_trustAllServersBssNet(), config.trustAllServersBssNet, checkbox -> config.trustAllServersBssNet = checkbox.getChecked()); - config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net.tooltip"))); + config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_trustAllServersBssNet_tooltip())); } //configs for server-sided features @@ -135,13 +136,13 @@ public BetterStatsConfigScreen(@Nullable Screen parent) { //register commands config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.register_commands"), + BST.config_registerCommands(), config.registerCommands, checkbox -> config.registerCommands = checkbox.getChecked()); //enable stat announcement system config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.enable_sas"), + BST.config_enableSas(), config.enableServerSAS, checkbox -> config.enableServerSAS = checkbox.getChecked()); } diff --git a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/api/client/registry/BSClientPlayerBadges.java b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/api/client/registry/BSClientPlayerBadges.java index 4052bbca..a7f90cf4 100644 --- a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/api/client/registry/BSClientPlayerBadges.java +++ b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/api/client/registry/BSClientPlayerBadges.java @@ -3,13 +3,13 @@ import static io.github.thecsdev.betterstats.api.client.gui.panel.BSComponentPanel.BS_WIDGETS_TEXTURE; import static io.github.thecsdev.tcdcommons.api.client.registry.TClientRegistries.PLAYER_BADGE_RENDERER; import static io.github.thecsdev.tcdcommons.api.registry.TRegistries.PLAYER_BADGE; -import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; import java.awt.Rectangle; import io.github.thecsdev.betterstats.BetterStats; import io.github.thecsdev.betterstats.api.client.badge.BSClientPlayerBadge; import io.github.thecsdev.betterstats.api.util.stats.SUItemStat; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.util.UITexture; import io.github.thecsdev.tcdcommons.api.client.render.badge.PBTextureRenderer; import io.github.thecsdev.tcdcommons.api.registry.TRegistries; @@ -38,20 +38,20 @@ public static final void register() {} { //create badges final var dedication = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.description")); + BST.pbadge_dedication_title(), + BST.pbadge_dedication_description()); final var loyalty = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.description")); + BST.pbadge_loyalty_title(), + BST.pbadge_loyalty_description()); final var the_next_generation = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.description")); + BST.pbadge_nextgen_title(), + BST.pbadge_nextgen_description()); final var adventurous_traveler = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.description")); + BST.pbadge_advtravel_title(), + BST.pbadge_advtravel_description()); final var perennial_survivor = new BSClientPlayerBadge( - translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.title"), - translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.description")); + BST.pbadge_psurvivor_title(), + BST.pbadge_psurvivor_description()); //set badge criteria dedication.setStatCriteria(sp -> (sp.getStatValue(Stats.CUSTOM, Stats.PLAY_TIME) > 20736000) ? 1 : 0); diff --git a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/screen/hud/BetterStatsHudScreen.java b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/screen/hud/BetterStatsHudScreen.java index 295d75ee..506a029e 100644 --- a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/screen/hud/BetterStatsHudScreen.java +++ b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/screen/hud/BetterStatsHudScreen.java @@ -15,6 +15,7 @@ import io.github.thecsdev.betterstats.BetterStats; import io.github.thecsdev.betterstats.BetterStatsConfig; import io.github.thecsdev.betterstats.client.network.BetterStatsClientNetworkHandler; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.screen.TScreenWrapper; import io.github.thecsdev.tcdcommons.api.client.gui.screen.TWidgetHudScreen; import io.github.thecsdev.tcdcommons.api.client.gui.util.TDrawContext; @@ -34,12 +35,11 @@ public final class BetterStatsHudScreen extends TWidgetHudScreen implements IParentScreenProvider { // ================================================== - private static final String P = "betterstats.client.gui.screen.hud.betterstatshudscreen"; - public static final Text TEXT_TITLE = translatable(P); - public static final Text TEXT_TUTORIAL_1 = translatable(P + ".tutorial_1"); - public static final Text TEXT_TUTORIAL_2 = translatable(P + ".tutorial_2"); - public static final Text TEXT_TUTORIAL_3 = translatable(P + ".tutorial_3"); - public static final Text TEXT_LIVE_TOGGLE = translatable(P + ".live_stats_toggle"); + public static final Text TEXT_TITLE = BST.hud_title(); + public static final Text TEXT_TUTORIAL_1 = BST.hud_tutorial1(); + public static final Text TEXT_TUTORIAL_2 = BST.hud_tutorial2(); + public static final Text TEXT_TUTORIAL_3 = BST.hud_tutorial3(); + public static final Text TEXT_LIVE_TOGGLE = BST.hud_liveStatsToggle(); // public static final Identifier HUD_SCREEN_ID = new Identifier(getModID(), "stats_hud"); // -------------------------------------------------- diff --git a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/panel/StatsTabPanel.java b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/panel/StatsTabPanel.java index d982cd6c..76460847 100644 --- a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/panel/StatsTabPanel.java +++ b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/panel/StatsTabPanel.java @@ -1,7 +1,6 @@ package io.github.thecsdev.betterstats.client.gui.stats.panel; import static io.github.thecsdev.betterstats.BetterStats.getModID; -import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; import java.util.Objects; @@ -16,6 +15,7 @@ import io.github.thecsdev.betterstats.api.client.util.StatFilterSettings; import io.github.thecsdev.betterstats.api.util.io.IStatsProvider; import io.github.thecsdev.betterstats.client.gui.stats.panel.StatFiltersPanel.StatFiltersPanelProxy; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement; import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement; import io.github.thecsdev.tcdcommons.api.client.gui.widget.TScrollBarWidget; @@ -29,7 +29,7 @@ public final class StatsTabPanel extends BSComponentPanel { // ================================================== - public static final Text TXT_NO_STATS_YET = translatable("betterstats.client.gui.stats.panel.statstabpanel.no_stats_yet"); + public static final Text TXT_NO_STATS_YET = BST.sTab_noStatsYet(); public static final Identifier FILTER_ID_SCROLL_CACHE = new Identifier(getModID(), "stats_scroll_cache"); // -------------------------------------------------- protected final StatsTabPanelProxy proxy; diff --git a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/BSConfigTab.java b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/BSConfigTab.java index 187cbfff..92a2c569 100644 --- a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/BSConfigTab.java +++ b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/BSConfigTab.java @@ -9,6 +9,7 @@ import io.github.thecsdev.betterstats.api.client.gui.util.StatsTabUtils; import io.github.thecsdev.betterstats.api.client.registry.BSStatsTabs; import io.github.thecsdev.betterstats.api.client.registry.StatsTab; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.config.TConfigPanelBuilder; import io.github.thecsdev.tcdcommons.api.client.gui.widget.TButtonWidget; import net.minecraft.client.gui.tooltip.Tooltip; @@ -39,29 +40,29 @@ public final class BSConfigTab extends StatsTab { //debug mode this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.debug_mode"), + BST.config_debugMode(), BetterStatsConfig.DEBUG_MODE, checkbox -> BetterStatsConfig.DEBUG_MODE = checkbox.getChecked()); //gui smooth scroll this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll"), + BST.config_guiSmoothScroll(), config.guiSmoothScroll, checkbox -> config.guiSmoothScroll = checkbox.getChecked()); - this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll.tooltip"))); + this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_guiSmoothScroll_tooltip())); //gui mobs follow cursor this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_mob_follow_cursor"), + BST.config_guiMobsFollowCursor(), config.guiMobsFollowCursor, checkbox -> config.guiMobsFollowCursor = checkbox.getChecked()); //trust all servers bss network this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net"), + BST.config_trustAllServersBssNet(), config.trustAllServersBssNet, checkbox -> config.trustAllServersBssNet = checkbox.getChecked()); - this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net.tooltip"))); + this.config_builder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_trustAllServersBssNet_tooltip())); } //configs for server-sided features @@ -69,13 +70,13 @@ public final class BSConfigTab extends StatsTab { //register commands this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.register_commands"), + BST.config_registerCommands(), config.registerCommands, checkbox -> config.registerCommands = checkbox.getChecked()); //enable stat announcement system this.config_builder.addCheckbox( - translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.enable_sas"), + BST.config_enableSas(), config.enableServerSAS, checkbox -> config.enableServerSAS = checkbox.getChecked()); } diff --git a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/GeneralStatsTab.java b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/GeneralStatsTab.java index 45201a14..066f6fad 100644 --- a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/GeneralStatsTab.java +++ b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/GeneralStatsTab.java @@ -23,6 +23,7 @@ import io.github.thecsdev.betterstats.api.util.stats.SUGeneralStat; import io.github.thecsdev.betterstats.client.gui.screen.hud.BetterStatsHudScreen; import io.github.thecsdev.betterstats.client.gui.screen.hud.entry.StatsHudGeneralEntry; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.other.TFillColorElement; import io.github.thecsdev.tcdcommons.api.client.gui.other.TLabelElement; import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement; @@ -75,7 +76,7 @@ ); final var ws2 = new CustomStatElement( wsp.getX(), wsp.getEndY() - CustomStatElement.HEIGHT, wsp.getWidth(), - translatable("betterstats.client.gui.stats.panel.statstabpanel.seed_sha256"), + BST.sTab_hashedSeed(), literal(Objects.toString(getBiomeAccessSeed(world.getBiomeAccess()))) ); wsp.addChild(ws1, false); @@ -97,7 +98,7 @@ statWidget.eContextMenu.register((__, cMenu) -> { - cMenu.addButton(translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"), ___ -> + cMenu.addButton(BST.hud_pinStat(), ___ -> { final var hud = BetterStatsHudScreen.getInstance(); hud.setParentScreen(MC_CLIENT.currentScreen); diff --git a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/ItemStatsTab.java b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/ItemStatsTab.java index 49a17d64..9a5b1bf8 100644 --- a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/ItemStatsTab.java +++ b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/ItemStatsTab.java @@ -26,6 +26,7 @@ import io.github.thecsdev.betterstats.api.util.stats.SUItemStat; import io.github.thecsdev.betterstats.client.gui.screen.hud.BetterStatsHudScreen; import io.github.thecsdev.betterstats.client.gui.screen.hud.entry.StatsHudItemEntry; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement; import io.github.thecsdev.tcdcommons.api.util.annotations.Virtual; import net.minecraft.text.Text; @@ -96,7 +97,7 @@ { widget.eContextMenu.register((__, cMenu) -> { - cMenu.addButton(translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"), ___ -> + cMenu.addButton(BST.hud_pinStat(), ___ -> { final var hud = BetterStatsHudScreen.getInstance(); hud.setParentScreen(MC_CLIENT.currentScreen); diff --git a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/MobStatsTab.java b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/MobStatsTab.java index 67c94a10..38e518f9 100644 --- a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/MobStatsTab.java +++ b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/client/gui/stats/tabs/MobStatsTab.java @@ -25,6 +25,7 @@ import io.github.thecsdev.betterstats.api.util.stats.SUMobStat; import io.github.thecsdev.betterstats.client.gui.screen.hud.BetterStatsHudScreen; import io.github.thecsdev.betterstats.client.gui.screen.hud.entry.StatsHudMobEntry; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.client.gui.panel.TPanelElement; import io.github.thecsdev.tcdcommons.api.util.annotations.Virtual; import net.minecraft.entity.SpawnGroup; @@ -97,7 +98,7 @@ { widget.eContextMenu.register((__, cMenu) -> { - cMenu.addButton(translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"), ___ -> + cMenu.addButton(BST.hud_pinStat(), ___ -> { final var hud = BetterStatsHudScreen.getInstance(); hud.setParentScreen(MC_CLIENT.currentScreen); diff --git a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/network/BetterStatsNetworkHandler.java b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/network/BetterStatsNetworkHandler.java index 1296c0c5..bfd0e7b6 100644 --- a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/network/BetterStatsNetworkHandler.java +++ b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/network/BetterStatsNetworkHandler.java @@ -1,12 +1,11 @@ package io.github.thecsdev.betterstats.network; -import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; - import java.util.WeakHashMap; import org.jetbrains.annotations.ApiStatus.Internal; import io.github.thecsdev.betterstats.BetterStats; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.api.events.server.PlayerManagerEvent; import io.github.thecsdev.tcdcommons.api.network.CustomPayloadNetwork; import io.github.thecsdev.tcdcommons.api.network.packet.TCustomPayload; @@ -25,8 +24,8 @@ // ================================================== private BetterStatsNetworkHandler() {} // -------------------------------------------------- - public static final Text TXT_TOGGLE_TOOLTIP = translatable("betterstats.network.betterstatsnetworkhandler.toggle_tooltip"); - public static final Text TXT_CONSENT_WARNING = translatable("betterstats.network.betterstatsnetworkhandler.consent_warning"); + public static final Text TXT_TOGGLE_TOOLTIP = BST.net_toggleTooltip(); + public static final Text TXT_CONSENT_WARNING = BST.net_consentWarning(); // public static final int NETWORK_VERSION = 2; // diff --git a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/util/BST.java b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/util/BST.java new file mode 100644 index 00000000..d9cebe6c --- /dev/null +++ b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/util/BST.java @@ -0,0 +1,61 @@ +package io.github.thecsdev.betterstats.util; + +import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; +import org.jetbrains.annotations.ApiStatus.Internal; + +import io.github.thecsdev.betterstats.BetterStats; +import net.minecraft.text.MutableText; +import net.minecraft.text.Text; + +/** + * {@link BetterStats} {@link Text}s. + * @apiNote Used to keep track of all of {@link BetterStats}'s {@link Text}s in one place. + */ +public final @Internal class BST +{ + // ================================================== + private BST() {} + // ================================================== + // -------------------------------------------------- + public static final MutableText sTab_noStatsYet() { return translatable("betterstats.client.gui.stats.panel.statstabpanel.no_stats_yet"); } + public static final MutableText sTab_hashedSeed() { return translatable("betterstats.client.gui.stats.panel.statstabpanel.seed_sha256"); } + // -------------------------------------------------- + public static final MutableText config_debugMode() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.debug_mode"); } + public static final MutableText config_guiSmoothScroll() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll"); } + public static final MutableText config_guiSmoothScroll_tooltip() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_smooth_scroll.tooltip"); } + public static final MutableText config_guiMobsFollowCursor() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.gui_mob_follow_cursor"); } + public static final MutableText config_trustAllServersBssNet() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net"); } + public static final MutableText config_trustAllServersBssNet_tooltip() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.trust_all_servers_bss_net.tooltip"); } + public static final MutableText config_registerCommands() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.register_commands"); } + public static final MutableText config_enableSas() { return translatable("betterstats.api.client.gui.screen.betterstatsconfigscreen.enable_sas"); } + // -------------------------------------------------- + public static final MutableText pbadge_dedication_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.title"); } + public static final MutableText pbadge_dedication_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.dedication.description"); } + public static final MutableText pbadge_loyalty_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.title"); } + public static final MutableText pbadge_loyalty_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.loyalty.description"); } + public static final MutableText pbadge_nextgen_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.title"); } + public static final MutableText pbadge_nextgen_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.the_next_generation.description"); } + public static final MutableText pbadge_advtravel_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.title"); } + public static final MutableText pbadge_advtravel_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.adventurous_traveler.description"); } + public static final MutableText pbadge_psurvivor_title() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.title"); } + public static final MutableText pbadge_psurvivor_description() { return translatable("betterstats.api.client.registry.bsclientplayerbadges.perennial_survivor.description"); } + // -------------------------------------------------- + public static final MutableText hud_title() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen"); } + public static final MutableText hud_pinStat() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.pin_stat"); } + public static final MutableText hud_liveStatsToggle() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.live_stats_toggle"); } + public static final MutableText hud_tutorial1() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.tutorial_1"); } + public static final MutableText hud_tutorial2() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.tutorial_2"); } + public static final MutableText hud_tutorial3() { return translatable("betterstats.client.gui.screen.hud.betterstatshudscreen.tutorial_3"); } + // -------------------------------------------------- + public static final MutableText net_toggleTooltip() { return translatable("betterstats.network.betterstatsnetworkhandler.toggle_tooltip"); } + public static final MutableText net_consentWarning() { return translatable("betterstats.network.betterstatsnetworkhandler.consent_warning"); } + // -------------------------------------------------- + public static final MutableText sas_firstMine(Text player, Text block) { return translatable("betterstats.util.stats.statannouncementsystem.first_mine", player, block); } + public static final MutableText sas_firstCraft(Text player, Text item) { return translatable("betterstats.util.stats.statannouncementsystem.first_craft", player, item); } + public static final MutableText sas_firstDeath(Text player) { return translatable("betterstats.util.stats.statannouncementsystem.first_death", player); } + public static final MutableText sas_firstDeath_hc1(Text player) { return translatable("betterstats.util.stats.statannouncementsystem.first_death.hc1", player); } + public static final MutableText sas_firstKill(Text player, Text entity) { return translatable("betterstats.util.stats.statannouncementsystem.first_kill", player, entity); } + public static final MutableText sas_firstDeathTo(Text player, Text entity) { return translatable("betterstats.util.stats.statannouncementsystem.first_death_to", player, entity); } + public static final MutableText sas_custom(Text player, Text stat, Text value) { return translatable("betterstats.util.stats.statannouncementsystem.custom", player, stat, value); } + // ================================================== +} \ No newline at end of file diff --git a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/util/stats/StatAnnouncementSystem.java b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/util/stats/StatAnnouncementSystem.java index a291f735..b92fcdd4 100644 --- a/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/util/stats/StatAnnouncementSystem.java +++ b/betterstats-3-fabric-1.20.4/src/main/java/io/github/thecsdev/betterstats/util/stats/StatAnnouncementSystem.java @@ -1,7 +1,7 @@ package io.github.thecsdev.betterstats.util.stats; +import static io.github.thecsdev.betterstats.api.util.stats.SUGeneralStat.getGeneralStatText; import static io.github.thecsdev.tcdcommons.api.util.TextUtils.literal; -import static io.github.thecsdev.tcdcommons.api.util.TextUtils.translatable; import java.util.HashSet; import java.util.Objects; @@ -13,6 +13,7 @@ import io.github.thecsdev.betterstats.BetterStats; import io.github.thecsdev.betterstats.BetterStatsConfig; import io.github.thecsdev.betterstats.network.BetterStatsNetworkHandler; +import io.github.thecsdev.betterstats.util.BST; import io.github.thecsdev.tcdcommons.TCDCommons; import net.minecraft.block.Block; import net.minecraft.entity.EntityType; @@ -31,7 +32,6 @@ import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import net.minecraft.util.InvalidIdentifierException; -import static io.github.thecsdev.betterstats.api.util.stats.SUGeneralStat.getGeneralStatText; /** * A {@link Class} that handles announcing players doing @@ -42,15 +42,6 @@ public final @Internal class StatAnnouncementSystem { // ================================================== - private static final String P = "betterstats.util.stats.statannouncementsystem."; //prefix - public static final String TXT_FIRST_MINED = P + "first_mine"; - public static final String TXT_FIRST_CRAFTED = P + "first_craft"; - public static final String TXT_FIRST_DEATH = P + "first_death"; - public static final String TXT_FIRST_DEATH_HC1 = P + "first_death.hc1"; - public static final String TXT_FIRST_KILLED = P + "first_kill"; - public static final String TXT_FIRST_KILLED_BY = P + "first_death_to"; - public static final String TXT_CUSTOM = P + "custom"; - // private static final Text WATERMARK; private static final BetterStatsConfig BSSC; private static final SASConfig SASC; @@ -277,7 +268,7 @@ public static final void broadcastFirstMine(ServerPlayerEntity player, Block min final var pText = formatPlayerText(player); final var bText = formatBlockText(minedBlock); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_FIRST_MINED, pText, bText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_firstMine(pText, bText)), literal("").append(WATERMARK).append(" ") .append(pText).append(" just mined their first ").append(bText).append(".")); } @@ -293,7 +284,7 @@ public static final void broadcastFirstCraft(ServerPlayerEntity player, Item cra final var pText = formatPlayerText(player); final var iText = formatItemText(craftedItem); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_FIRST_CRAFTED, pText, iText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_firstCraft(pText, iText)), literal("").append(WATERMARK).append(" ") .append(pText).append(" just crafted their first ").append(iText).append(".")); } @@ -309,7 +300,7 @@ public static final void broadcastFirstKilled(ServerPlayerEntity player, EntityT final var pText = formatPlayerText(player); final var etText = formatEntityTypeText(victimType); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_FIRST_KILLED, pText, etText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_firstKill(pText, etText)), literal("").append(WATERMARK).append(" ").append(pText) .append(" just killed a ").append(etText).append(" for their first time.")); } @@ -325,7 +316,7 @@ public static final void broadcastFirstKilledBy(ServerPlayerEntity player, Entit final var pText = formatPlayerText(player); final var etText = formatEntityTypeText(killerType); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_FIRST_KILLED_BY, pText, etText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_firstDeathTo(pText, etText)), literal("").append(WATERMARK).append(" ").append(pText) .append(" just died to a ").append(etText).append(" for their first time.")); } @@ -338,12 +329,12 @@ public static final void broadcastFirstKilledBy(ServerPlayerEntity player, Entit public static final void broadcastFirstDeath(ServerPlayerEntity player) { final var hardcore = player.getServer().isHardcore(); - final var key = hardcore ? TXT_FIRST_DEATH_HC1 : TXT_FIRST_DEATH; final var literalBrightSide = hardcore ? " On the bright side, it likely won't happen again." : ""; final var pText = formatPlayerText(player); + final var translatableText = hardcore ? BST.sas_firstDeath_hc1(pText) : BST.sas_firstDeath(pText); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(key, pText)), + literal("").append(WATERMARK).append(" ").append(translatableText), literal("").append(WATERMARK).append(" ") .append(pText).append(" died for their first time." + literalBrightSide)); } @@ -362,7 +353,7 @@ public static final void broadcastFirstCustomStat( final var sText = literal("").append(getGeneralStatText(stat)).formatted(Formatting.GRAY); final var vText = literal(statValue).formatted(Formatting.GREEN); broadcastBssMessage(player.getServer(), - literal("").append(WATERMARK).append(" ").append(translatable(TXT_CUSTOM, pText, sText, vText)), + literal("").append(WATERMARK).append(" ").append(BST.sas_custom(pText, sText, vText)), literal("").append(WATERMARK).append(" ").append(pText) .append(" just increased their ").append(sText).append(" stat value to ") .append(vText).append("."));