mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2026-01-04 15:31:38 +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
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user