mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2025-12-29 11:49:08 +00:00
Allow title animation sound to accept custom sounds
This commit is contained in:
@@ -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
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user