diff --git a/api/src/main/java/net/islandearth/rpgregions/utils/TitleAnimator.java b/api/src/main/java/net/islandearth/rpgregions/utils/TitleAnimator.java index 2ca095f..7c49890 100644 --- a/api/src/main/java/net/islandearth/rpgregions/utils/TitleAnimator.java +++ b/api/src/main/java/net/islandearth/rpgregions/utils/TitleAnimator.java @@ -1,5 +1,6 @@ package net.islandearth.rpgregions.utils; +import com.google.common.base.Enums; import net.islandearth.rpgregions.api.IRPGRegionsAPI; import net.kyori.adventure.text.Component; import net.kyori.adventure.title.Title; @@ -10,7 +11,6 @@ import org.bukkit.scheduler.BukkitRunnable; import java.time.Duration; import java.util.List; -import java.util.Locale; public class TitleAnimator { @@ -36,8 +36,19 @@ public class TitleAnimator { final String animationSound = plugin.getConfig().getString("settings.server.discoveries.discovered.title.animation_sound", Sound.BLOCK_TRIPWIRE_CLICK_ON.name()); final int animationSoundPitch = plugin.getConfig().getInt("settings.server.discoveries.discovered.title.animation_sound_pitch", 1); if (current >= 1) { - final Sound sound = Sound.valueOf(animationSound.toUpperCase(Locale.ROOT)); - player.playSound(player.getLocation(), sound, 1f, animationSoundPitch); + Enums.getIfPresent(Sound.class, animationSound).toJavaUtil().ifPresentOrElse(sound -> { + player.playSound( + player.getLocation(), + sound, + 1, + animationSoundPitch + ); + }, () -> player.playSound( + player.getLocation(), + animationSound, + 1, + animationSoundPitch + )); } } diff --git a/rpgregions/src/main/resources/config.yml b/rpgregions/src/main/resources/config.yml index 28ca303..60626d3 100644 --- a/rpgregions/src/main/resources/config.yml +++ b/rpgregions/src/main/resources/config.yml @@ -50,10 +50,10 @@ settings: fadeout: 20 animation_speed: 20 # Controls how fast the animation moves to the next frame cooldown: 0 - animation_sound: BLOCK_TRIPWIRE_CLICK_ON # Sound to play during animation + animation_sound: "BLOCK_TRIPWIRE_CLICK_ON" # Sound to play during animation animation_sound_pitch: 1 sound: - name: UI_TOAST_CHALLENGE_COMPLETE + name: "UI_TOAST_CHALLENGE_COMPLETE" # You can use custom resource pack sounds as well. pitch: 1 undiscovered: name-colour: "<#F43D3D>" # The colour of undiscovered item titles in the discovery GUI