Skip to content

Commit aad39e3

Browse files
authored
Merge pull request #14 from ThatOneDevil/fabric
Minor fixes in lang files, try catch for menu, build.yml fixes
2 parents 92e4001 + 21b1862 commit aad39e3

File tree

6 files changed

+60
-31
lines changed

6 files changed

+60
-31
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ jobs:
2525
- name: setup gradle
2626
uses: gradle/actions/setup-gradle@v4
2727
with:
28-
gradle-home-cache-cleanup: true
28+
cache-cleanup: always
2929

3030
- name: make gradle wrapper executable
3131
run: chmod +x ./gradlew
3232

3333
- name: build
3434
run: ./gradlew build
3535

36-
- name: capture build artifacts
36+
- name: Upload build artifacts
3737
uses: actions/upload-artifact@v4
3838
with:
39-
name: Artifacts
40-
path: build/libs/
39+
name: artifacts
40+
path: versions/*/build/libs/*.jar
41+
retention-days: 30

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,20 @@ public void onInitializeClient() {
6969
ScamShieldCommand.register(dispatcher);
7070
});
7171

72-
if (PackCoreConfig.enableCustomMenu) {
73-
ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> {
74-
if (screen instanceof TitleScreen) {
75-
client.execute(() -> client.setScreen(PackCoreConfig.haveShownWelcomeWizard
76-
? new SBEStyledTitleScreen()
77-
: new WelcomeWizardPage())
78-
);
79-
}
80-
});
72+
// try catch just in case something goes wrong with title screen
73+
try {
74+
if (PackCoreConfig.enableCustomMenu) {
75+
ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> {
76+
if (screen instanceof TitleScreen) {
77+
client.execute(() -> client.setScreen(PackCoreConfig.haveShownWelcomeWizard
78+
? new SBEStyledTitleScreen()
79+
: new WelcomeWizardPage())
80+
);
81+
}
82+
});
83+
}
84+
} catch (Exception e) {
85+
LOGGER.error("Failed to show custom title screen: {}", e.getMessage());
8186
}
8287

8388
if (!PackCoreConfig.haveSetBobbyConfig) {
Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package com.github.kd_gaming1.packcore.command.scamshield;
22

33
import com.mojang.brigadier.CommandDispatcher;
4+
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
5+
import com.mojang.brigadier.context.CommandContext;
46
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
57
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
8+
import net.minecraft.text.Text;
9+
import net.minecraft.util.Formatting;
610

711
/**
812
* Main entry point for all ScamShield commands.
@@ -13,16 +17,19 @@ public class ScamShieldCommand {
1317
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher) {
1418
dispatcher.register(
1519
ClientCommandManager.literal("scamshield")
16-
.then(ScamShieldHelpCommand.register())
17-
.then(ScamShieldControlCommands.registerToggle())
18-
.then(ScamShieldControlCommands.registerReload())
19-
.then(ScamShieldStatsCommands.registerStats())
20-
.then(ScamShieldStatsCommands.registerClear())
21-
.then(ScamShieldTestCommands.registerTest())
22-
.then(ScamShieldTestCommands.registerDebug())
23-
.then(ScamShieldWhitelistCommands.register())
24-
.then(ScamShieldPreviewCommands.register())
25-
.then(ScamShieldEducationCommand.register())
20+
.executes(ScamShieldHelpCommand::execute)
21+
22+
.then(ScamShieldHelpCommand.register())
23+
.then(ScamShieldControlCommands.registerToggle())
24+
.then(ScamShieldControlCommands.registerReload())
25+
.then(ScamShieldStatsCommands.registerStats())
26+
.then(ScamShieldStatsCommands.registerClear())
27+
.then(ScamShieldTestCommands.registerTest())
28+
.then(ScamShieldTestCommands.registerDebug())
29+
.then(ScamShieldWhitelistCommands.register())
30+
.then(ScamShieldPreviewCommands.register())
31+
.then(ScamShieldEducationCommand.register())
2632
);
2733
}
34+
2835
}

src/main/java/com/github/kd_gaming1/packcore/command/scamshield/ScamShieldHelpCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static LiteralArgumentBuilder<FabricClientCommandSource> register() {
1515
return ClientCommandManager.literal("help").executes(ScamShieldHelpCommand::execute);
1616
}
1717

18-
private static int execute(CommandContext<FabricClientCommandSource> context) {
18+
public static int execute(CommandContext<FabricClientCommandSource> context) {
1919
var source = context.getSource();
2020

2121
source.sendFeedback(Text.literal("§7━━━━━━━━━━━━━━━━━━━━━━━━━━━━"));

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class PackCoreConfig extends MidnightConfig {
1616
public static boolean enableCustomMenu = true;
1717

1818
// Spacer
19-
@Comment(category = UI)
19+
@Comment(category = UI, name = "packcore.midnightconfig.spacer")
2020
public static Comment spacer1;
2121

2222
// BACKUP CATEGORY
@@ -27,7 +27,7 @@ public class PackCoreConfig extends MidnightConfig {
2727
public static int maxBackups = 5;
2828

2929
// Spacer
30-
@Comment(category = BACKUP)
30+
@Comment(category = BACKUP, name = "packcore.midnightconfig.spacer")
3131
public static Comment backupSpacer;
3232

3333
// CUSTOMIZATION CATEGORY
@@ -61,13 +61,13 @@ public class PackCoreConfig extends MidnightConfig {
6161
@Entry(category = SCAMSHIELD , name = "packcore.midnightconfig.enable_scamshield_debugging")
6262
public static boolean enableScamShieldDebugging = false;
6363

64-
@Comment(category = SCAMSHIELD)
64+
@Comment(category = SCAMSHIELD, name = "packcore.midnightconfig.spacer")
6565
public static Comment scamshieldSpacer1;
6666

6767
@Entry(category = SCAMSHIELD, name = "packcore.midnightconfig.scamshield_trigger_threshold", min = 50, max = 500)
6868
public static int scamShieldTriggerThreshold = 100;
6969

70-
@Comment(category = SCAMSHIELD)
70+
@Comment(category = SCAMSHIELD, name = "packcore.midnightconfig.spacer")
7171
public static Comment scamshieldSpacer2;
7272

7373
@Entry(category = SCAMSHIELD, name = "packcore.midnightconfig.scamshield_show_notifications")
@@ -79,13 +79,13 @@ public class PackCoreConfig extends MidnightConfig {
7979
@Entry(category = SCAMSHIELD, name = "packcore.midnightconfig.scamshield_max_recent_detections", min = 5, max = 50)
8080
public static int scamShieldMaxRecentDetections = 10;
8181

82-
@Comment(category = SCAMSHIELD)
82+
@Comment(category = SCAMSHIELD, name = "packcore.midnightconfig.spacer")
8383
public static Comment scamshieldSpacer3;
8484

8585
@Entry(category = SCAMSHIELD, name = "packcore.midnightconfig.scamshield_max_history_size", min = 10, max = 1000)
8686
public static int scamShieldMaxHistorySize = 100;
8787

88-
@Comment(category = SCAMSHIELD)
88+
@Comment(category = SCAMSHIELD, name = "packcore.midnightconfig.spacer")
8989
public static Comment scamshieldSpacer4;
9090

9191
@Entry(category = SCAMSHIELD, name = "packcore.midnightconfig.scamshield_regex_timeout_ms", min = 50, max = 500)

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,21 @@
1818
"packcore.midnightconfig.first_startup": "First Startup - Tracker",
1919
"packcore.midnightconfig.welcome_wizard_shown": "Welcome Wizard Shown - Tracker",
2020
"packcore.midnightconfig.have_set_bobby_config": "Have Set Bobby Config - Tracker",
21-
"packcore.midnightconfig.setup_wizard_completed": "Setup Wizard Completed - Tracker"
21+
"packcore.midnightconfig.setup_wizard_completed": "Setup Wizard Completed - Tracker",
22+
23+
"packcore.midnightconfig.scamshieldSpacer": "",
24+
25+
"packcore.midnightconfig.enable_scamshield": "Enable ScamShield",
26+
"packcore.midnightconfig.enable_scamshield_debugging":"Enable ScamShield Debugging",
27+
"packcore.midnightconfig.scamshield_trigger_threshold": "Scam shield Trigger Threshold",
28+
"packcore.midnightconfig.scamshield_show_notifications":"Toggle ScamShield Notifications",
29+
"packcore.midnightconfig.scamshield_notification_cooldown": "ScamShield Notification Cooldown (seconds)",
30+
"packcore.midnightconfig.scamshield_max_recent_detections": "Recent Detections",
31+
"packcore.midnightconfig.scamshield_max_history_size":"Maximum History Size",
32+
"packcore.midnightconfig.scamshield_regex_timeout_ms": "Regex Timeout (ms)",
33+
"packcore.midnightconfig.scamshield_cache_size": "Cache Size",
34+
"packcore.midnightconfig.scamshield_cache_ttl_seconds":"Cache TTL (seconds)",
35+
"packcore.midnightconfig.scamshield_conversation_timeout_minutes": "Conversation Timeout (minutes)",
36+
"packcore.midnightconfig.scamshield_max_messages_per_user": "Max Messages Per User",
37+
"packcore.midnightconfig.scamshield_max_progression_bonus": "Max Progression Bonus"
2238
}

0 commit comments

Comments
 (0)