mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2025-01-06 19:18:05 +01:00
simplify sound play
This commit is contained in:
parent
c13bfc2ec3
commit
1310171666
@ -723,26 +723,20 @@ public class GuiListener implements Listener {
|
|||||||
FileConfiguration config = Files.config.getConfiguration();
|
FileConfiguration config = Files.config.getConfiguration();
|
||||||
|
|
||||||
if (config.getBoolean("Settings.Sounds.Toggle", false)) {
|
if (config.getBoolean("Settings.Sounds.Toggle", false)) {
|
||||||
String sound = config.getString("Settings.Sounds.Sound");
|
String sound = config.getString("Settings.Sounds.Sound", "UI_BUTTON_CLICK");
|
||||||
|
|
||||||
try {
|
player.playSound(player.getLocation(), Sound.valueOf(sound), 1, 1);
|
||||||
player.playSound(player.getLocation(), Sound.valueOf(sound), 1, 1);
|
|
||||||
} catch (Exception e) {
|
|
||||||
player.playSound(player.getLocation(), Sound.UI_BUTTON_CLICK, SoundCategory.PLAYERS, 1F, 1F);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playSoldSound(@NotNull Player player) {
|
private void playSoldSound(@NotNull Player player) {
|
||||||
FileConfiguration config = Files.config.getConfiguration();
|
FileConfiguration config = Files.config.getConfiguration();
|
||||||
|
|
||||||
String sound = config.getString("Settings.Sold-Item-Sound", "");
|
String sound = config.getString("Settings.Sold-Item-Sound", "UI_BUTTON_CLICK");
|
||||||
|
|
||||||
if (sound.isEmpty()) return;
|
if (sound.isEmpty()) return;
|
||||||
|
|
||||||
try {
|
player.playSound(player.getLocation(), Sound.valueOf(sound), 1, 1);
|
||||||
player.playSound(player.getLocation(), Sound.valueOf(sound), 1, 1);
|
|
||||||
} catch (Exception ignored) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
Loading…
Reference in New Issue
Block a user