aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2022-03-10 21:08:52 -0500
committerbowser0000 <bowser0000@gmail.com>2022-03-10 21:08:52 -0500
commitccd38690657b767d06ccf2771183738b0a35654d (patch)
treee7424dbbef53a1acb40b04aeb48d67c013301fcb /src/main/java/me/Danker
parent21ec0b98fff64031c1e42e00487fd31463d5f26d (diff)
downloadSkyblockMod-ccd38690657b767d06ccf2771183738b0a35654d.tar.gz
SkyblockMod-ccd38690657b767d06ccf2771183738b0a35654d.tar.bz2
SkyblockMod-ccd38690657b767d06ccf2771183738b0a35654d.zip
Prevent crash from playing non .wav music
Diffstat (limited to 'src/main/java/me/Danker')
-rw-r--r--src/main/java/me/Danker/features/CustomMusic.java25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java
index 1f609cc..5153f91 100644
--- a/src/main/java/me/Danker/features/CustomMusic.java
+++ b/src/main/java/me/Danker/features/CustomMusic.java
@@ -229,14 +229,23 @@ public class CustomMusic {
public void start() throws UnsupportedAudioFileException, LineUnavailableException, IOException {
- if (music == null) music = AudioSystem.getClip();
- if (!music.isRunning()) {
- reset();
- shuffle();
- setVolume(volume);
- cancelNotes = true;
- music.setMicrosecondPosition(0);
- music.start();
+ try {
+ if (music == null) music = AudioSystem.getClip();
+ if (!music.isRunning()) {
+ reset();
+ shuffle();
+ setVolume(volume);
+ cancelNotes = true;
+ music.setMicrosecondPosition(0);
+ music.start();
+ }
+ } catch (UnsupportedAudioFileException ex) {
+ ex.printStackTrace();
+
+ EntityPlayer player = Minecraft.getMinecraft().thePlayer;
+ if (player != null) {
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Attempted to play non .wav file. Please use a .wav converter instead of renaming the file."));
+ }
}
}