diff options
Diffstat (limited to 'src/main/java')
3 files changed, 82 insertions, 17 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; |