diff options
| author | vicisacat <victor.branchu@gmail.com> | 2024-04-24 18:28:11 +0200 | 
|---|---|---|
| committer | viciscat <51047087+viciscat@users.noreply.github.com> | 2024-06-02 13:26:45 +0200 | 
| commit | 0e55c9e00b406e8cec007e551e4661d80f6c1b2e (patch) | |
| tree | 9425637374b82e03eb3e1bf0b3d016ae348c0c54 /src/main/java/de/hysky/skyblocker/config | |
| parent | a2c9ef1192f903c4aaf3e048da621e53b600ec5e (diff) | |
| download | Skyblocker-0e55c9e00b406e8cec007e551e4661d80f6c1b2e.tar.gz Skyblocker-0e55c9e00b406e8cec007e551e4661d80f6c1b2e.tar.bz2 Skyblocker-0e55c9e00b406e8cec007e551e4661d80f6c1b2e.zip | |
GOAT HORN YEA BABY
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/config')
| -rw-r--r-- | src/main/java/de/hysky/skyblocker/config/categories/EventNotificationsCategory.java | 28 | 
1 files changed, 23 insertions, 5 deletions
| diff --git a/src/main/java/de/hysky/skyblocker/config/categories/EventNotificationsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/EventNotificationsCategory.java index 5b33f7cf..af30f502 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/EventNotificationsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/EventNotificationsCategory.java @@ -1,12 +1,12 @@  package de.hysky.skyblocker.config.categories; +import de.hysky.skyblocker.config.ConfigUtils;  import de.hysky.skyblocker.config.SkyblockerConfig;  import de.hysky.skyblocker.skyblock.events.EventNotifications;  import de.hysky.skyblocker.utils.config.DurationController; -import dev.isxander.yacl3.api.ConfigCategory; -import dev.isxander.yacl3.api.ListOption; -import dev.isxander.yacl3.api.OptionDescription; -import dev.isxander.yacl3.api.OptionGroup; +import dev.isxander.yacl3.api.*; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.sound.PositionedSoundInstance;  import net.minecraft.text.Text;  import java.util.ArrayList; @@ -15,9 +15,27 @@ import java.util.Map;  public class EventNotificationsCategory { -    public static ConfigCategory create(SkyblockerConfig config) { +    private static boolean shouldPlaySound = false; + +    public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig config) { +        shouldPlaySound = false;          return ConfigCategory.createBuilder()                  .name(Text.literal("Event Notifications")) +                .option(Option.<SkyblockerConfig.EventNotifications.Sound>createBuilder() +                        .binding(defaults.eventNotifications.reminderSound, +                                () -> config.eventNotifications.reminderSound, +                                sound -> config.eventNotifications.reminderSound = sound) +                        .controller(ConfigUtils::createEnumCyclingListController) +                        .name(Text.literal("Notification Sound")) +                        .listener((soundOption, sound) -> { +                            if (!shouldPlaySound) { +                                shouldPlaySound = true; +                                return; +                            } +                            if (sound.getSoundEvent() != null) +                                MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(sound.getSoundEvent(), 1f, 1f)); +                        }) +                        .build())                  .groups(createGroups(config))                  .build(); | 
