Skip to content

Commit e5c792d

Browse files
committed
Handle EOFException
Changed version info to 1.1.9.
1 parent 63eda75 commit e5c792d

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.xxmicloxx</groupId>
88
<artifactId>NoteBlockAPI</artifactId>
9-
<version>1.1.8</version>
9+
<version>1.1.9</version>
1010

1111
<properties>
1212
<maven.compiler.source>1.8</maven.compiler.source>

src/main/java/com/xxmicloxx/NoteBlockAPI/NBSDecoder.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
package com.xxmicloxx.NoteBlockAPI;
22

33
import java.io.DataInputStream;
4+
import java.io.EOFException;
45
import java.io.File;
56
import java.io.FileInputStream;
67
import java.io.FileNotFoundException;
78
import java.io.IOException;
89
import java.io.InputStream;
910
import java.util.HashMap;
1011

12+
import org.bukkit.Bukkit;
13+
import org.bukkit.ChatColor;
14+
1115
public class NBSDecoder {
1216

1317
public static Song parse(File decodeFile) {
@@ -83,6 +87,12 @@ private static Song parse(InputStream inputStream, File decodeFile) {
8387
return new Song(speed, layerHashMap, songHeight, length, title, author, description, decodeFile, customInstruments);
8488
} catch (FileNotFoundException e) {
8589
e.printStackTrace();
90+
} catch (EOFException e){
91+
String file = "";
92+
if (decodeFile != null){
93+
file = decodeFile.getName();
94+
}
95+
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "Song is corrupted " + file);
8696
} catch (IOException e) {
8797
e.printStackTrace();
8898
}

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: NoteBlockAPI
22

33
main: com.xxmicloxx.NoteBlockAPI.NoteBlockPlayerMain
4-
version: 1.1.8
4+
version: 1.1.9
55

66
description: a developer interface to play nbs-files ingame
77
authors: [xxmicloxx, michidk, koca2000, Luck]

0 commit comments

Comments
 (0)