Search in sources :

Example 1 with UnloadableWorldException

use of org.pepsoft.worldpainter.UnloadableWorldException in project WorldPainter by Captain-Chaos.

the class GetWorldOp method go.

@Override
public World2 go() throws ScriptException {
    goCalled();
    File file = sanityCheckFileName(fileName);
    WorldIO worldIO = new WorldIO();
    try {
        worldIO.load(new FileInputStream(file));
    } catch (IOException e) {
        throw new ScriptException("I/O error while loading world " + fileName, e);
    } catch (UnloadableWorldException e) {
        throw new ScriptException("Unloadable world " + fileName + " (not a WorldPainter world?)", e);
    }
    return worldIO.getWorld();
}
Also used : UnloadableWorldException(org.pepsoft.worldpainter.UnloadableWorldException) WorldIO(org.pepsoft.worldpainter.WorldIO) IOException(java.io.IOException) File(java.io.File) FileInputStream(java.io.FileInputStream)

Aggregations

File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 UnloadableWorldException (org.pepsoft.worldpainter.UnloadableWorldException)1 WorldIO (org.pepsoft.worldpainter.WorldIO)1