Fix compile issue

This commit is contained in:
nossr50 2020-05-01 14:38:58 -07:00
parent 7615ff472d
commit 7114ff02e5

View File

@ -40,9 +40,11 @@ public class WorldBlacklist {
} }
private void loadBlacklist(File blackListFile) { private void loadBlacklist(File blackListFile) {
FileReader fileReader = null;
BufferedReader bufferedReader = null;
try { try {
FileReader fileReader = new FileReader(blackListFile); fileReader = new FileReader(blackListFile);
BufferedReader bufferedReader = new BufferedReader(fileReader); bufferedReader = new BufferedReader(fileReader);
String currentLine; String currentLine;
@ -54,20 +56,29 @@ public class WorldBlacklist {
if(!blacklist.contains(currentLine)) if(!blacklist.contains(currentLine))
blacklist.add(currentLine); blacklist.add(currentLine);
} }
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) } catch (IOException e) {
{
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
//Close readers //Close readers
if(bufferedReader != null) bufferedReader.close(); closeRead(bufferedReader);
if(fileReader != null) fileReader.close(); closeRead(fileReader);
} }
plugin.getLogger().info(blacklist.size()+" entries in mcMMO World Blacklist"); plugin.getLogger().info(blacklist.size()+" entries in mcMMO World Blacklist");
} }
private void closeRead(Reader reader) {
if(reader != null) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static boolean isWorldBlacklisted(World world) public static boolean isWorldBlacklisted(World world)
{ {