Skip to content

Commit

Permalink
Release 3.13.7+fabric-1.21.X
Browse files Browse the repository at this point in the history
Added a config property for hiding player info.
  • Loading branch information
TheCSDev committed Jan 22, 2025
1 parent 5b28918 commit aacfdde
Show file tree
Hide file tree
Showing 159 changed files with 14,157 additions and 54 deletions.
2 changes: 1 addition & 1 deletion betterstats-3-fabric-1.21.3/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ org.gradle.jvmargs=-Xmx1G
mod_name = Better Statistics Screen
mod_description = Improves the statistics screen and makes it more useful.
mod_author = TheCSDev
mod_version = 3.13.6+fabric-1.21.3
mod_version = 3.13.7+fabric-1.21.3

# Here you link the source code repository links:
mod_contact_homepage = https://github.com/TheCSMods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class BetterStatsConfig extends AutoConfig
public @SerializedAs("client-wideStatsPanel") boolean wideStatsPanel = false; //v3.12+
public @SerializedAs("client-centeredStatsPanel") boolean centeredStatsPanel = false; //v3.12+
public @SerializedAs("client-updateItemGroupsOnJoin") boolean updateItemGroupsOnJoin = true; //3.13.6
public @SerializedAs("client-hidePlayerInfo") boolean hidePlayerInfo = false; //3.13.7
public @SerializedAs("server-registerCommands") boolean registerCommands = true;
public @SerializedAs("server-enableSAS") boolean enableServerSAS = false;
public @SerializedAs("server-sasConfig") SASConfig sasConfig = new SASConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import org.jetbrains.annotations.Nullable;

import io.github.thecsdev.betterstats.BetterStats;
import io.github.thecsdev.betterstats.api.client.gui.panel.BSComponentPanel;
import io.github.thecsdev.betterstats.api.client.gui.screen.BetterStatsScreen;
import io.github.thecsdev.betterstats.api.client.registry.BSStatsTabs;
Expand Down Expand Up @@ -211,21 +212,24 @@ public MenuBarPanel(int x, int y, int width, MenuBarPanelProxy proxy) throws Nul
addChild(menu, true);

//add the display name label
final var statsProvider = this.proxy.getStatsProvider();
final boolean isESP = (statsProvider instanceof IEditableStatsProvider);

@Nullable Text displayName = (statsProvider != null) ? statsProvider.getDisplayName() : null;
if(displayName == null) displayName = literal("-"); //both conditions above can return null

final int displayNameW = getTextRenderer().getWidth(displayName);

final int menuSP = menu.getScrollPadding();
final var lbl_displayName = new TLabelElement(
menu.getEndX() - (menuSP + displayNameW + getTextRenderer().fontHeight), menu.getY() + menuSP,
displayNameW, menu.getHeight() - (menuSP*2),
displayName);
lbl_displayName.setTextColor(isESP ? 0xFFFFFFFF : BSStatsTabs.COLOR_SPECIAL);
addChild(lbl_displayName, false);
if(!BetterStats.getInstance().getConfig().hidePlayerInfo)
{
final var statsProvider = this.proxy.getStatsProvider();
final boolean isESP = (statsProvider instanceof IEditableStatsProvider);

@Nullable Text displayName = (statsProvider != null) ? statsProvider.getDisplayName() : null;
if(displayName == null) displayName = literal("-"); //both conditions above can return null

final int displayNameW = getTextRenderer().getWidth(displayName);

final int menuSP = menu.getScrollPadding();
final var lbl_displayName = new TLabelElement(
menu.getEndX() - (menuSP + displayNameW + getTextRenderer().fontHeight), menu.getY() + menuSP,
displayNameW, menu.getHeight() - (menuSP*2),
displayName);
lbl_displayName.setTextColor(isESP ? 0xFFFFFFFF : BSStatsTabs.COLOR_SPECIAL);
addChild(lbl_displayName, false);
}
}
// ==================================================
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ private static final void initConfigGui_clientSide(BetterStatsConfig config, TCo
config.updateItemGroupsOnJoin,
checkbox -> config.updateItemGroupsOnJoin = checkbox.getChecked());
configBuilder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_updDspCtxOnJoin_tooltip()));

//hide player info
configBuilder.addCheckbox(
BST.config_hidePlayerInfo(),
config.hidePlayerInfo,
checkbox -> config.hidePlayerInfo = checkbox.getChecked());
configBuilder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_hidePlayerInfo_tooltip()));
}

private static final void initConfigGui_serverSide(BetterStatsConfig config, TConfigPanelBuilder<?> configBuilder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import org.jetbrains.annotations.ApiStatus.Internal;

import io.github.thecsdev.betterstats.BetterStats;
import io.github.thecsdev.betterstats.BetterStatsConfig;
import io.github.thecsdev.betterstats.api.client.gui.stats.panel.GameProfilePanel;
import io.github.thecsdev.betterstats.api.client.gui.stats.widget.CustomStatElement;
Expand Down Expand Up @@ -62,8 +63,11 @@

// ---------- initialize gui
//game profile panel
final var panel_gp = new GameProfilePanel(sp, sp, panel.getWidth() - (sp*2), statsProvider);
panel.addChild(panel_gp, true);
if(!BetterStats.getInstance().getConfig().hidePlayerInfo)
{
final var panel_gp = new GameProfilePanel(sp, sp, panel.getWidth() - (sp*2), statsProvider);
panel.addChild(panel_gp, true);
}

// ---------- "debug mode"-specific statistics
if(BetterStatsConfig.DEBUG_MODE && statsProvider instanceof LocalPlayerStatsProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ private BST() {}
public static final MutableText config_centeredStatsPanel_tooltip() { return translatable("betterstats.config.centered_stats_panel.tooltip"); }
public static final MutableText config_updDspCtxOnJoin() { return translatable("betterstats.config.update_itemgroups_onjoin"); }
public static final MutableText config_updDspCtxOnJoin_tooltip() { return translatable("betterstats.config.update_itemgroups_onjoin.tooltip"); }
public static final MutableText config_hidePlayerInfo() { return translatable("betterstats.config.hide_player_info"); }
public static final MutableText config_hidePlayerInfo_tooltip() { return translatable("betterstats.config.hide_player_info.tooltip"); }
// --------------------------------------------------
public static final MutableText pbadge_dedication_title() { return translatable("betterstats.player_badge.dedication.title"); }
public static final MutableText pbadge_dedication_description() { return translatable("betterstats.player_badge.dedication.description"); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
"betterstats.config.centered_stats_panel.tooltip": "When enabled, the statistics panel (aka the entire GUI) is centered on the screen.\nHas no effect and does nothing when \"Wide statistics panel\" is enabled.",
"betterstats.config.update_itemgroups_onjoin": "Update item groups on join",
"betterstats.config.update_itemgroups_onjoin.tooltip": "For performance and item grouping reasons, this mod by default automatically updates item groups whenever you join a game. Otherwise, the game does this whenever you open your inventory.\n\nDisable this if this behavior is undesired or causes compatibility issues. Disabling this may cause items to appear ungrouped in the statistics screen.",
"betterstats.config.hide_player_info": "Hide player info",
"betterstats.config.hide_player_info.tooltip": "Hides player information from the Statistics screen.",

"betterstats.player_badge.dedication.title": "Dedication",
"betterstats.player_badge.dedication.description": "You've shown true dedication! You have played on this world for at least 12 days (288 hours).",
Expand Down
2 changes: 1 addition & 1 deletion betterstats-3-fabric-1.21.4/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ org.gradle.jvmargs=-Xmx1G
mod_name = Better Statistics Screen
mod_description = Improves the statistics screen and makes it more useful.
mod_author = TheCSDev
mod_version = 3.13.6+fabric-1.21.4
mod_version = 3.13.7+fabric-1.21.4

# Here you link the source code repository links:
mod_contact_homepage = https://github.com/TheCSMods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class BetterStatsConfig extends AutoConfig
public @SerializedAs("client-wideStatsPanel") boolean wideStatsPanel = false; //v3.12+
public @SerializedAs("client-centeredStatsPanel") boolean centeredStatsPanel = false; //v3.12+
public @SerializedAs("client-updateItemGroupsOnJoin") boolean updateItemGroupsOnJoin = true; //3.13.6
public @SerializedAs("client-hidePlayerInfo") boolean hidePlayerInfo = false; //3.13.7
public @SerializedAs("server-registerCommands") boolean registerCommands = true;
public @SerializedAs("server-enableSAS") boolean enableServerSAS = false;
public @SerializedAs("server-sasConfig") SASConfig sasConfig = new SASConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import org.jetbrains.annotations.Nullable;

import io.github.thecsdev.betterstats.BetterStats;
import io.github.thecsdev.betterstats.api.client.gui.panel.BSComponentPanel;
import io.github.thecsdev.betterstats.api.client.gui.screen.BetterStatsScreen;
import io.github.thecsdev.betterstats.api.client.registry.BSStatsTabs;
Expand Down Expand Up @@ -211,21 +212,24 @@ public MenuBarPanel(int x, int y, int width, MenuBarPanelProxy proxy) throws Nul
addChild(menu, true);

//add the display name label
final var statsProvider = this.proxy.getStatsProvider();
final boolean isESP = (statsProvider instanceof IEditableStatsProvider);

@Nullable Text displayName = (statsProvider != null) ? statsProvider.getDisplayName() : null;
if(displayName == null) displayName = literal("-"); //both conditions above can return null

final int displayNameW = getTextRenderer().getWidth(displayName);

final int menuSP = menu.getScrollPadding();
final var lbl_displayName = new TLabelElement(
menu.getEndX() - (menuSP + displayNameW + getTextRenderer().fontHeight), menu.getY() + menuSP,
displayNameW, menu.getHeight() - (menuSP*2),
displayName);
lbl_displayName.setTextColor(isESP ? 0xFFFFFFFF : BSStatsTabs.COLOR_SPECIAL);
addChild(lbl_displayName, false);
if(!BetterStats.getInstance().getConfig().hidePlayerInfo)
{
final var statsProvider = this.proxy.getStatsProvider();
final boolean isESP = (statsProvider instanceof IEditableStatsProvider);

@Nullable Text displayName = (statsProvider != null) ? statsProvider.getDisplayName() : null;
if(displayName == null) displayName = literal("-"); //both conditions above can return null

final int displayNameW = getTextRenderer().getWidth(displayName);

final int menuSP = menu.getScrollPadding();
final var lbl_displayName = new TLabelElement(
menu.getEndX() - (menuSP + displayNameW + getTextRenderer().fontHeight), menu.getY() + menuSP,
displayNameW, menu.getHeight() - (menuSP*2),
displayName);
lbl_displayName.setTextColor(isESP ? 0xFFFFFFFF : BSStatsTabs.COLOR_SPECIAL);
addChild(lbl_displayName, false);
}
}
// ==================================================
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ private static final void initConfigGui_clientSide(BetterStatsConfig config, TCo
config.updateItemGroupsOnJoin,
checkbox -> config.updateItemGroupsOnJoin = checkbox.getChecked());
configBuilder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_updDspCtxOnJoin_tooltip()));

//hide player info
configBuilder.addCheckbox(
BST.config_hidePlayerInfo(),
config.hidePlayerInfo,
checkbox -> config.hidePlayerInfo = checkbox.getChecked());
configBuilder.getLastAddedElement().setTooltip(Tooltip.of(BST.config_hidePlayerInfo_tooltip()));
}

private static final void initConfigGui_serverSide(BetterStatsConfig config, TConfigPanelBuilder<?> configBuilder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import org.jetbrains.annotations.ApiStatus.Internal;

import io.github.thecsdev.betterstats.BetterStats;
import io.github.thecsdev.betterstats.BetterStatsConfig;
import io.github.thecsdev.betterstats.api.client.gui.stats.panel.GameProfilePanel;
import io.github.thecsdev.betterstats.api.client.gui.stats.widget.CustomStatElement;
Expand Down Expand Up @@ -62,8 +63,11 @@

// ---------- initialize gui
//game profile panel
final var panel_gp = new GameProfilePanel(sp, sp, panel.getWidth() - (sp*2), statsProvider);
panel.addChild(panel_gp, true);
if(!BetterStats.getInstance().getConfig().hidePlayerInfo)
{
final var panel_gp = new GameProfilePanel(sp, sp, panel.getWidth() - (sp*2), statsProvider);
panel.addChild(panel_gp, true);
}

// ---------- "debug mode"-specific statistics
if(BetterStatsConfig.DEBUG_MODE && statsProvider instanceof LocalPlayerStatsProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ private BST() {}
public static final MutableText config_centeredStatsPanel_tooltip() { return translatable("betterstats.config.centered_stats_panel.tooltip"); }
public static final MutableText config_updDspCtxOnJoin() { return translatable("betterstats.config.update_itemgroups_onjoin"); }
public static final MutableText config_updDspCtxOnJoin_tooltip() { return translatable("betterstats.config.update_itemgroups_onjoin.tooltip"); }
public static final MutableText config_hidePlayerInfo() { return translatable("betterstats.config.hide_player_info"); }
public static final MutableText config_hidePlayerInfo_tooltip() { return translatable("betterstats.config.hide_player_info.tooltip"); }
// --------------------------------------------------
public static final MutableText pbadge_dedication_title() { return translatable("betterstats.player_badge.dedication.title"); }
public static final MutableText pbadge_dedication_description() { return translatable("betterstats.player_badge.dedication.description"); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
"betterstats.config.centered_stats_panel.tooltip": "When enabled, the statistics panel (aka the entire GUI) is centered on the screen.\nHas no effect and does nothing when \"Wide statistics panel\" is enabled.",
"betterstats.config.update_itemgroups_onjoin": "Update item groups on join",
"betterstats.config.update_itemgroups_onjoin.tooltip": "For performance and item grouping reasons, this mod by default automatically updates item groups whenever you join a game. Otherwise, the game does this whenever you open your inventory.\n\nDisable this if this behavior is undesired or causes compatibility issues. Disabling this may cause items to appear ungrouped in the statistics screen.",
"betterstats.config.hide_player_info": "Hide player info",
"betterstats.config.hide_player_info.tooltip": "Hides player information from the Statistics screen.",

"betterstats.player_badge.dedication.title": "Dedication",
"betterstats.player_badge.dedication.description": "You've shown true dedication! You have played on this world for at least 12 days (288 hours).",
Expand Down
39 changes: 39 additions & 0 deletions betterstats-3-fabric-1.21.5/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain platforms or Java versions, and provides a first line of defence
# against bad commits.

name: build
on: [pull_request, push]

jobs:
build:
strategy:
matrix:
# Use these Java versions
java: [
17, # Current Java LTS & minimum supported by Minecraft
]
# and run on both Linux and Windows
os: [ubuntu-20.04, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
Loading

0 comments on commit aacfdde

Please sign in to comment.