mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-27 21:05:35 +01:00
Other small fixes
This commit is contained in:
parent
19c1a356f7
commit
15828f320d
@ -116,13 +116,14 @@ public class ReadimageCommand extends HologramSubCommand {
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
throw new CommandException("The provided URL was not valid.");
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new CommandException("The image '" + args[1] + "' doesn't exist in the plugin's folder.");
|
||||
} catch (TooWideException e) {
|
||||
throw new CommandException("The image is too large. Max width allowed is " + ImageMessage.MAX_WIDTH + " pixels.");
|
||||
} catch (UnreadableImageException e) {
|
||||
throw new CommandException("The plugin was unable to read the image. Be sure that the format is supported.");
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new CommandException("The image \"" + args[1] + "\" doesn't exist in the plugin's folder.");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new CommandException("I/O exception while reading the image. " + (isUrl ? "Is the URL valid?" : "Is it in use?"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -19,6 +19,10 @@ public class FileUtils {
|
||||
|
||||
public static List<String> readLines(File file) throws IOException, Exception {
|
||||
|
||||
if (!file.isFile()) {
|
||||
throw new FileNotFoundException(file.getName());
|
||||
}
|
||||
|
||||
BufferedReader br = null;
|
||||
|
||||
try {
|
||||
@ -50,6 +54,10 @@ public class FileUtils {
|
||||
|
||||
public static BufferedImage readImage(File file) throws UnreadableImageException, IOException, Exception {
|
||||
|
||||
if (!file.isFile()) {
|
||||
throw new FileNotFoundException(file.getName());
|
||||
}
|
||||
|
||||
BufferedImage image = ImageIO.read(file);
|
||||
|
||||
if (image == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user