aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorKevin <92656833+kevinthegreat1@users.noreply.github.com>2024-01-11 04:25:18 +0800
committerGitHub <noreply@github.com>2024-01-10 15:25:18 -0500
commit52e4ce7fe81bb2af8af102b0270c0eac12a34f48 (patch)
tree8347ce567c830124fb7035693d607c7e9d630285 /src/main
parent54bfef4b1e2d9d2b3abd1649bf01d7856adf7ad4 (diff)
downloadSkyblocker-52e4ce7fe81bb2af8af102b0270c0eac12a34f48.tar.gz
Skyblocker-52e4ce7fe81bb2af8af102b0270c0eac12a34f48.tar.bz2
Skyblocker-52e4ce7fe81bb2af8af102b0270c0eac12a34f48.zip
Add dungeon score title and sound (#480)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java16
-rw-r--r--src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java52
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java31
-rw-r--r--src/main/resources/assets/skyblocker/lang/en_us.json8
4 files changed, 88 insertions, 19 deletions
diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
index f8eb4e55..83c69d2c 100644
--- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
+++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
@@ -729,13 +729,25 @@ public class SkyblockerConfig {
public static class DungeonScore {
@SerialEntry
- public boolean enableDungeonScore270 = true;
+ public boolean enableDungeonScore270Message = false;
+
+ @SerialEntry
+ public boolean enableDungeonScore270Title = false;
+
+ @SerialEntry
+ public boolean enableDungeonScore270Sound = false;
@SerialEntry
public String dungeonScore270Message = "270 Score Reached!";
@SerialEntry
- public boolean enableDungeonScore300 = true;
+ public boolean enableDungeonScore300Message = true;
+
+ @SerialEntry
+ public boolean enableDungeonScore300Title = true;
+
+ @SerialEntry
+ public boolean enableDungeonScore300Sound = true;
@SerialEntry
public String dungeonScore300Message = "300 Score Reached!";
diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java
index e4340ebc..8872953e 100644
--- a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java
+++ b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java
@@ -172,11 +172,27 @@ public class DungeonsCategory {
.name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore"))
.collapsed(true)
.option(Option.<Boolean>createBuilder()
- .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScore", 270))
- .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScore.@Tooltip", 270)))
- .binding(defaults.locations.dungeons.dungeonScore.enableDungeonScore270,
- () -> config.locations.dungeons.dungeonScore.enableDungeonScore270,
- newValue -> config.locations.dungeons.dungeonScore.enableDungeonScore270 = newValue)
+ .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreMessage", 270))
+ .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreMessage.@Tooltip", 270)))
+ .binding(defaults.locations.dungeons.dungeonScore.enableDungeonScore270Message,
+ () -> config.locations.dungeons.dungeonScore.enableDungeonScore270Message,
+ newValue -> config.locations.dungeons.dungeonScore.enableDungeonScore270Message = newValue)
+ .controller(ConfigUtils::createBooleanController)
+ .build())
+ .option(Option.<Boolean>createBuilder()
+ .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreTitle", 270))
+ .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreTitle.@Tooltip", 270)))
+ .binding(defaults.locations.dungeons.dungeonScore.enableDungeonScore270Title,
+ () -> config.locations.dungeons.dungeonScore.enableDungeonScore270Title,
+ newValue -> config.locations.dungeons.dungeonScore.enableDungeonScore270Title = newValue)
+ .controller(ConfigUtils::createBooleanController)
+ .build())
+ .option(Option.<Boolean>createBuilder()
+ .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreSound", 270))
+ .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreSound.@Tooltip", 270)))
+ .binding(defaults.locations.dungeons.dungeonScore.enableDungeonScore270Sound,
+ () -> config.locations.dungeons.dungeonScore.enableDungeonScore270Sound,
+ newValue -> config.locations.dungeons.dungeonScore.enableDungeonScore270Sound = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<String>createBuilder()
@@ -188,11 +204,27 @@ public class DungeonsCategory {
.controller(StringControllerBuilder::create)
.build())
.option(Option.<Boolean>createBuilder()
- .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScore", 300))
- .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScore.@Tooltip", 300)))
- .binding(defaults.locations.dungeons.dungeonScore.enableDungeonScore300,
- () -> config.locations.dungeons.dungeonScore.enableDungeonScore300,
- newValue -> config.locations.dungeons.dungeonScore.enableDungeonScore300 = newValue)
+ .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreMessage", 300))
+ .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreMessage.@Tooltip", 300)))
+ .binding(defaults.locations.dungeons.dungeonScore.enableDungeonScore300Message,
+ () -> config.locations.dungeons.dungeonScore.enableDungeonScore300Message,
+ newValue -> config.locations.dungeons.dungeonScore.enableDungeonScore300Message = newValue)
+ .controller(ConfigUtils::createBooleanController)
+ .build())
+ .option(Option.<Boolean>createBuilder()
+ .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreTitle", 300))
+ .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreTitle.@Tooltip", 300)))
+ .binding(defaults.locations.dungeons.dungeonScore.enableDungeonScore300Title,
+ () -> config.locations.dungeons.dungeonScore.enableDungeonScore300Title,
+ newValue -> config.locations.dungeons.dungeonScore.enableDungeonScore300Title = newValue)
+ .controller(ConfigUtils::createBooleanController)
+ .build())
+ .option(Option.<Boolean>createBuilder()
+ .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreSound", 300))
+ .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreSound.@Tooltip", 300)))
+ .binding(defaults.locations.dungeons.dungeonScore.enableDungeonScore300Sound,
+ () -> config.locations.dungeons.dungeonScore.enableDungeonScore300Sound,
+ newValue -> config.locations.dungeons.dungeonScore.enableDungeonScore300Sound = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<String>createBuilder()
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java
index cef5efa1..d67d6988 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonScore.java
@@ -8,6 +8,8 @@ import de.hysky.skyblocker.utils.Utils;
import de.hysky.skyblocker.utils.scheduler.MessageScheduler;
import de.hysky.skyblocker.utils.scheduler.Scheduler;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.sound.SoundEvents;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -24,7 +26,8 @@ public class DungeonScore {
}
public static void tick() {
- if (!Utils.isInDungeons()) {
+ MinecraftClient client = MinecraftClient.getInstance();
+ if (!Utils.isInDungeons() || client.player == null) {
reset();
return;
}
@@ -36,12 +39,30 @@ public class DungeonScore {
}
int score = Integer.parseInt(dungeonClearedMatcher.group("score"));
if (!DungeonManager.isInBoss()) score += 28;
- if (CONFIG.enableDungeonScore270 && !sent270 && score >= 270 && score < 300) {
- MessageScheduler.INSTANCE.sendMessageAfterCooldown(Constants.PREFIX.get().getString() + CONFIG.dungeonScore270Message.replaceAll("\\[score]", "270"));
+ if (!sent270 && score >= 270 && score < 300) {
+ if (CONFIG.enableDungeonScore270Message) {
+ MessageScheduler.INSTANCE.sendMessageAfterCooldown(Constants.PREFIX.get().getString() + CONFIG.dungeonScore270Message.replaceAll("\\[score]", "270"));
+ }
+ if (CONFIG.enableDungeonScore270Title) {
+ client.inGameHud.setDefaultTitleFade();
+ client.inGameHud.setTitle(Constants.PREFIX.get().append(CONFIG.dungeonScore270Message.replaceAll("\\[score]", "270")));
+ }
+ if (CONFIG.enableDungeonScore270Sound) {
+ client.player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_PLING.value(), 100f, 0.1f);
+ }
sent270 = true;
}
- if (CONFIG.enableDungeonScore300 && !sent300 && score >= 300) {
- MessageScheduler.INSTANCE.sendMessageAfterCooldown(Constants.PREFIX.get().getString() + CONFIG.dungeonScore300Message.replaceAll("\\[score]", "300"));
+ if (!sent300 && score >= 300) {
+ if (CONFIG.enableDungeonScore300Message) {
+ MessageScheduler.INSTANCE.sendMessageAfterCooldown(Constants.PREFIX.get().getString() + CONFIG.dungeonScore300Message.replaceAll("\\[score]", "300"));
+ }
+ if (CONFIG.enableDungeonScore300Title) {
+ client.inGameHud.setDefaultTitleFade();
+ client.inGameHud.setTitle(Constants.PREFIX.get().append(CONFIG.dungeonScore300Message.replaceAll("\\[score]", "300")));
+ }
+ if (CONFIG.enableDungeonScore300Sound) {
+ client.player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_PLING.value(), 100f, 0.1f);
+ }
sent300 = true;
}
break;
diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json
index a1475770..421d74bd 100644
--- a/src/main/resources/assets/skyblocker/lang/en_us.json
+++ b/src/main/resources/assets/skyblocker/lang/en_us.json
@@ -191,8 +191,12 @@
"text.autoconfig.skyblocker.option.locations.dungeons.doorHighlight.doorHighlightType.@Tooltip": "Highlight: Only displays a highlight.\n\nOutlined Highlight: Displays both a highlight and an outline.\n\nOutline: Only displays an outline.",
"text.autoconfig.skyblocker.option.locations.dungeons.doorHighlight.doorHighlightType.secretWaypointsNote": "\n\n\nNote: Dungeon Secret Waypoints must be enabled for this to work.",
"text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore": "Dungeon Score",
- "text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScore": "Enable Dungeon Score %d",
- "text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScore.@Tooltip": "Sends a message in chat when reaching %d score in dungeons.",
+ "text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreMessage": "Enable Dungeon Score %d Message",
+ "text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreMessage.@Tooltip": "Sends a message in chat when reaching %d score in dungeons.",
+ "text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreTitle": "Enable Dungeon Score %d Title",
+ "text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreTitle.@Tooltip": "Display a title when reaching %d score in dungeons.",
+ "text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreSound": "Enable Dungeon Score %d Sound",
+ "text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.enableDungeonScoreSound.@Tooltip": "Plays a sound when reaching %d score in dungeons.",
"text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.dungeonScoreMessage": "Dungeon Score %d Message",
"text.autoconfig.skyblocker.option.locations.dungeons.dungeonScore.dungeonScoreMessage.@Tooltip": "Message which will be sent in the chat when reaching %d score in dungeons. The string \"[score]\" will be replaced with the dungeon score (%d).",
"text.autoconfig.skyblocker.option.locations.dungeons.dungeonChestProfit": "Dungeon Chest Profit Calculator",